diff --git a/.sdk-version b/.sdk-version index 151f7f2..0e286b1 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v2.63.0 +v2.66.0 diff --git a/README.md b/README.md index 73f1668..a0c524b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 2.63.0 + 2.66.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:2.63.0" + implementation "ai.reveng:sdk:2.66.0" } ``` @@ -100,6 +100,7 @@ Class | Method | HTTP request | Description *AnalysesDynamicExecutionApi* | [**getProcessRegistry**](docs/AnalysesDynamicExecutionApi.md#getProcessRegistry) | **GET** /v2/analyses/{analysis_id}/dynamic-execution/process-registry | Get the dynamic execution results for process registry *AnalysesDynamicExecutionApi* | [**getProcessTree**](docs/AnalysesDynamicExecutionApi.md#getProcessTree) | **GET** /v2/analyses/{analysis_id}/dynamic-execution/process-tree | Get the dynamic execution results for process tree *AnalysesDynamicExecutionApi* | [**getTtps**](docs/AnalysesDynamicExecutionApi.md#getTtps) | **GET** /v2/analyses/{analysis_id}/dynamic-execution/ttps | Get the dynamic execution results for ttps +*AnalysesResultsMetadataApi* | [**getAnalysisFunctionsPaginated**](docs/AnalysesResultsMetadataApi.md#getAnalysisFunctionsPaginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis *AnalysesResultsMetadataApi* | [**getCapabilities**](docs/AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis *AnalysesResultsMetadataApi* | [**getCommunities**](docs/AnalysesResultsMetadataApi.md#getCommunities) | **GET** /v2/analyses/{analysis_id}/communities | Gets the communities found in the analysis *AnalysesResultsMetadataApi* | [**getFunctionsList**](docs/AnalysesResultsMetadataApi.md#getFunctionsList) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis @@ -128,10 +129,7 @@ Class | Method | HTTP request | Description *CollectionsApi* | [**updateCollection**](docs/CollectionsApi.md#updateCollection) | **PATCH** /v2/collections/{collection_id} | Updates a collection *CollectionsApi* | [**updateCollectionBinaries**](docs/CollectionsApi.md#updateCollectionBinaries) | **PATCH** /v2/collections/{collection_id}/binaries | Updates a collection binaries *CollectionsApi* | [**updateCollectionTags**](docs/CollectionsApi.md#updateCollectionTags) | **PATCH** /v2/collections/{collection_id}/tags | Updates a collection tags -*ExternalSourcesApi* | [**createExternalTaskMb**](docs/ExternalSourcesApi.md#createExternalTaskMb) | **POST** /v2/analysis/{analysis_id}/external/mb | Pulls data from VirusTotal *ExternalSourcesApi* | [**createExternalTaskVt**](docs/ExternalSourcesApi.md#createExternalTaskVt) | **POST** /v2/analysis/{analysis_id}/external/vt | Pulls data from VirusTotal -*ExternalSourcesApi* | [**getMbData**](docs/ExternalSourcesApi.md#getMbData) | **GET** /v2/analysis/{analysis_id}/external/mb | Get MalwareBazaar data -*ExternalSourcesApi* | [**getMbTaskStatus**](docs/ExternalSourcesApi.md#getMbTaskStatus) | **GET** /v2/analysis/{analysis_id}/external/mb/status | Check the status of MalwareBazaar data retrieval *ExternalSourcesApi* | [**getVtData**](docs/ExternalSourcesApi.md#getVtData) | **GET** /v2/analysis/{analysis_id}/external/vt | Get VirusTotal data *ExternalSourcesApi* | [**getVtTaskStatus**](docs/ExternalSourcesApi.md#getVtTaskStatus) | **GET** /v2/analysis/{analysis_id}/external/vt/status | Check the status of VirusTotal data retrieval *FirmwareApi* | [**getBinariesForFirmwareTask**](docs/FirmwareApi.md#getBinariesForFirmwareTask) | **GET** /v2/firmware/get-binaries/{task_id} | Upload firmware for unpacking @@ -194,6 +192,7 @@ Class | Method | HTTP request | Description - [AnalysisFunctionMapping](docs/AnalysisFunctionMapping.md) - [AnalysisFunctionMatchingRequest](docs/AnalysisFunctionMatchingRequest.md) - [AnalysisFunctions](docs/AnalysisFunctions.md) + - [AnalysisFunctionsList](docs/AnalysisFunctionsList.md) - [AnalysisRecord](docs/AnalysisRecord.md) - [AnalysisScope](docs/AnalysisScope.md) - [AnalysisStringsResponse](docs/AnalysisStringsResponse.md) @@ -215,6 +214,7 @@ Class | Method | HTTP request | Description - [BaseResponseAnalysisDetailResponse](docs/BaseResponseAnalysisDetailResponse.md) - [BaseResponseAnalysisFunctionMapping](docs/BaseResponseAnalysisFunctionMapping.md) - [BaseResponseAnalysisFunctions](docs/BaseResponseAnalysisFunctions.md) + - [BaseResponseAnalysisFunctionsList](docs/BaseResponseAnalysisFunctionsList.md) - [BaseResponseAnalysisStringsResponse](docs/BaseResponseAnalysisStringsResponse.md) - [BaseResponseAnalysisTags](docs/BaseResponseAnalysisTags.md) - [BaseResponseAnalysisUpdateTagsResponse](docs/BaseResponseAnalysisUpdateTagsResponse.md) @@ -353,6 +353,7 @@ Class | Method | HTTP request | Description - [FunctionInfoInput](docs/FunctionInfoInput.md) - [FunctionInfoInputFuncDepsInner](docs/FunctionInfoInputFuncDepsInner.md) - [FunctionInfoOutput](docs/FunctionInfoOutput.md) + - [FunctionListItem](docs/FunctionListItem.md) - [FunctionLocalVariableResponse](docs/FunctionLocalVariableResponse.md) - [FunctionMapping](docs/FunctionMapping.md) - [FunctionMappingFull](docs/FunctionMappingFull.md) diff --git a/build.gradle b/build.gradle index 348083c..fa19c4b 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '2.63.0' +version = '2.66.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "2.63.0") + coordinates("ai.reveng", "sdk", "2.66.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 726470a..6f62de9 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "2.63.0", + version := "2.66.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesResultsMetadataApi.md b/docs/AnalysesResultsMetadataApi.md index fff0ab1..8c063e0 100644 --- a/docs/AnalysesResultsMetadataApi.md +++ b/docs/AnalysesResultsMetadataApi.md @@ -4,6 +4,7 @@ All URIs are relative to *https://api.reveng.ai* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**getAnalysisFunctionsPaginated**](AnalysesResultsMetadataApi.md#getAnalysisFunctionsPaginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis | | [**getCapabilities**](AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis | | [**getCommunities**](AnalysesResultsMetadataApi.md#getCommunities) | **GET** /v2/analyses/{analysis_id}/communities | Gets the communities found in the analysis | | [**getFunctionsList**](AnalysesResultsMetadataApi.md#getFunctionsList) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis | @@ -13,6 +14,80 @@ All URIs are relative to *https://api.reveng.ai* | [**getVulnerabilities**](AnalysesResultsMetadataApi.md#getVulnerabilities) | **GET** /v2/analyses/{analysis_id}/vulnerabilities | Gets the vulnerabilities found in the analysis | + +# **getAnalysisFunctionsPaginated** +> BaseResponseAnalysisFunctionsList getAnalysisFunctionsPaginated(analysisId, page, pageSize) + +Get functions from analysis + +Returns a paginated list of functions identified during analysis + +### 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.AnalysesResultsMetadataApi; + +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"); + + AnalysesResultsMetadataApi apiInstance = new AnalysesResultsMetadataApi(defaultClient); + Integer analysisId = 56; // Integer | + Integer page = 1; // Integer | The page number to retrieve. + Integer pageSize = 1000; // Integer | Number of items per page. + try { + BaseResponseAnalysisFunctionsList result = apiInstance.getAnalysisFunctionsPaginated(analysisId, page, pageSize); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesResultsMetadataApi#getAnalysisFunctionsPaginated"); + 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**| | | +| **page** | **Integer**| The page number to retrieve. | [optional] [default to 1] | +| **pageSize** | **Integer**| Number of items per page. | [optional] [default to 1000] | + +### Return type + +[**BaseResponseAnalysisFunctionsList**](BaseResponseAnalysisFunctionsList.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 | - | + # **getCapabilities** > BaseResponseCapabilities getCapabilities(analysisId) diff --git a/docs/AnalysisFunctionsList.md b/docs/AnalysisFunctionsList.md new file mode 100644 index 0000000..1f4aca4 --- /dev/null +++ b/docs/AnalysisFunctionsList.md @@ -0,0 +1,14 @@ + + +# AnalysisFunctionsList + +API response schema for paginated functions list + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**functions** | [**List<FunctionListItem>**](FunctionListItem.md) | The functions associated with the analysis | | + + + diff --git a/docs/BaseResponseAnalysisFunctionsList.md b/docs/BaseResponseAnalysisFunctionsList.md new file mode 100644 index 0000000..46ea744 --- /dev/null +++ b/docs/BaseResponseAnalysisFunctionsList.md @@ -0,0 +1,17 @@ + + +# BaseResponseAnalysisFunctionsList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**AnalysisFunctionsList**](AnalysisFunctionsList.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/ExternalSourcesApi.md b/docs/ExternalSourcesApi.md index ef48932..6e0d1cb 100644 --- a/docs/ExternalSourcesApi.md +++ b/docs/ExternalSourcesApi.md @@ -4,83 +4,11 @@ All URIs are relative to *https://api.reveng.ai* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**createExternalTaskMb**](ExternalSourcesApi.md#createExternalTaskMb) | **POST** /v2/analysis/{analysis_id}/external/mb | Pulls data from VirusTotal | | [**createExternalTaskVt**](ExternalSourcesApi.md#createExternalTaskVt) | **POST** /v2/analysis/{analysis_id}/external/vt | Pulls data from VirusTotal | -| [**getMbData**](ExternalSourcesApi.md#getMbData) | **GET** /v2/analysis/{analysis_id}/external/mb | Get MalwareBazaar data | -| [**getMbTaskStatus**](ExternalSourcesApi.md#getMbTaskStatus) | **GET** /v2/analysis/{analysis_id}/external/mb/status | Check the status of MalwareBazaar data retrieval | | [**getVtData**](ExternalSourcesApi.md#getVtData) | **GET** /v2/analysis/{analysis_id}/external/vt | Get VirusTotal data | | [**getVtTaskStatus**](ExternalSourcesApi.md#getVtTaskStatus) | **GET** /v2/analysis/{analysis_id}/external/vt/status | Check the status of VirusTotal data retrieval | - -# **createExternalTaskMb** -> BaseResponseStr createExternalTaskMb(analysisId) - -Pulls data from VirusTotal - -### 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.ExternalSourcesApi; - -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"); - - ExternalSourcesApi apiInstance = new ExternalSourcesApi(defaultClient); - Integer analysisId = 56; // Integer | - try { - BaseResponseStr result = apiInstance.createExternalTaskMb(analysisId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling ExternalSourcesApi#createExternalTaskMb"); - 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 - -[**BaseResponseStr**](BaseResponseStr.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** | Request already queued | - | - # **createExternalTaskVt** > BaseResponseStr createExternalTaskVt(analysisId) @@ -150,143 +78,6 @@ public class Example { | **422** | Invalid request parameters | - | | **409** | Request already queued | - | - -# **getMbData** -> BaseResponseExternalResponse getMbData(analysisId) - -Get MalwareBazaar data - -### 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.ExternalSourcesApi; - -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"); - - ExternalSourcesApi apiInstance = new ExternalSourcesApi(defaultClient); - Integer analysisId = 56; // Integer | - try { - BaseResponseExternalResponse result = apiInstance.getMbData(analysisId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling ExternalSourcesApi#getMbData"); - 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 - -[**BaseResponseExternalResponse**](BaseResponseExternalResponse.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 | - | -| **404** | No data retrieved from MalwareBazaar for the given analysis_id | - | - - -# **getMbTaskStatus** -> BaseResponseTaskResponse getMbTaskStatus(analysisId) - -Check the status of MalwareBazaar data retrieval - -### 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.ExternalSourcesApi; - -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"); - - ExternalSourcesApi apiInstance = new ExternalSourcesApi(defaultClient); - Integer analysisId = 56; // Integer | - try { - BaseResponseTaskResponse result = apiInstance.getMbTaskStatus(analysisId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling ExternalSourcesApi#getMbTaskStatus"); - 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 - -[**BaseResponseTaskResponse**](BaseResponseTaskResponse.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 | - | - # **getVtData** > BaseResponseExternalResponse getVtData(analysisId) diff --git a/docs/FunctionListItem.md b/docs/FunctionListItem.md new file mode 100644 index 0000000..c5a52fb --- /dev/null +++ b/docs/FunctionListItem.md @@ -0,0 +1,18 @@ + + +# FunctionListItem + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Function id | | +|**name** | **String** | Name of the function | | +|**mangledName** | **String** | Mangled name of the function | | +|**vaddr** | **Long** | Function virtual address | | +|**size** | **Integer** | Function size in bytes | | +|**debug** | **Boolean** | Whether the function has debug information | | + + + diff --git a/pom.xml b/pom.xml index aa1f78b..ab80ebd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 2.63.0 + 2.66.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java b/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java index 8297d81..a2aa13a 100644 --- a/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java +++ b/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java @@ -28,6 +28,7 @@ import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseAnalysisFunctions; +import ai.reveng.model.BaseResponseAnalysisFunctionsList; import ai.reveng.model.BaseResponseAnalysisTags; import ai.reveng.model.BaseResponseCapabilities; import ai.reveng.model.BaseResponseCommunities; @@ -77,6 +78,153 @@ public void setCustomBaseUrl(String customBaseUrl) { this.localCustomBaseUrl = customBaseUrl; } + /** + * Build call for getAnalysisFunctionsPaginated + * @param analysisId (required) + * @param page The page number to retrieve. (optional, default to 1) + * @param pageSize Number of items per page. (optional, default to 1000) + * @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 getAnalysisFunctionsPaginatedCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, 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}/functions" + .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(); + + if (page != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize)); + } + + 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 getAnalysisFunctionsPaginatedValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, 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 getAnalysisFunctionsPaginated(Async)"); + } + + return getAnalysisFunctionsPaginatedCall(analysisId, page, pageSize, _callback); + + } + + /** + * Get functions from analysis + * Returns a paginated list of functions identified during analysis + * @param analysisId (required) + * @param page The page number to retrieve. (optional, default to 1) + * @param pageSize Number of items per page. (optional, default to 1000) + * @return BaseResponseAnalysisFunctionsList + * @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 BaseResponseAnalysisFunctionsList getAnalysisFunctionsPaginated(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize) throws ApiException { + ApiResponse localVarResp = getAnalysisFunctionsPaginatedWithHttpInfo(analysisId, page, pageSize); + return localVarResp.getData(); + } + + /** + * Get functions from analysis + * Returns a paginated list of functions identified during analysis + * @param analysisId (required) + * @param page The page number to retrieve. (optional, default to 1) + * @param pageSize Number of items per page. (optional, default to 1000) + * @return ApiResponse<BaseResponseAnalysisFunctionsList> + * @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 getAnalysisFunctionsPaginatedWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize) throws ApiException { + okhttp3.Call localVarCall = getAnalysisFunctionsPaginatedValidateBeforeCall(analysisId, page, pageSize, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get functions from analysis (asynchronously) + * Returns a paginated list of functions identified during analysis + * @param analysisId (required) + * @param page The page number to retrieve. (optional, default to 1) + * @param pageSize Number of items per page. (optional, default to 1000) + * @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 getAnalysisFunctionsPaginatedAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAnalysisFunctionsPaginatedValidateBeforeCall(analysisId, page, pageSize, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for getCapabilities * @param analysisId (required) diff --git a/src/main/java/ai/reveng/api/ExternalSourcesApi.java b/src/main/java/ai/reveng/api/ExternalSourcesApi.java index 390b4f1..10a7bdb 100644 --- a/src/main/java/ai/reveng/api/ExternalSourcesApi.java +++ b/src/main/java/ai/reveng/api/ExternalSourcesApi.java @@ -74,141 +74,6 @@ public void setCustomBaseUrl(String customBaseUrl) { this.localCustomBaseUrl = customBaseUrl; } - /** - * Build call for createExternalTaskMb - * @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 Request already queued -
- */ - public okhttp3.Call createExternalTaskMbCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v2/analysis/{analysis_id}/external/mb" - .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 createExternalTaskMbValidateBeforeCall(@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 createExternalTaskMb(Async)"); - } - - return createExternalTaskMbCall(analysisId, _callback); - - } - - /** - * Pulls data from VirusTotal - * - * @param analysisId (required) - * @return BaseResponseStr - * @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 Request already queued -
- */ - public BaseResponseStr createExternalTaskMb(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - ApiResponse localVarResp = createExternalTaskMbWithHttpInfo(analysisId); - return localVarResp.getData(); - } - - /** - * Pulls data from VirusTotal - * - * @param analysisId (required) - * @return ApiResponse<BaseResponseStr> - * @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 Request already queued -
- */ - public ApiResponse createExternalTaskMbWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - okhttp3.Call localVarCall = createExternalTaskMbValidateBeforeCall(analysisId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Pulls data from VirusTotal (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 Request already queued -
- */ - public okhttp3.Call createExternalTaskMbAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createExternalTaskMbValidateBeforeCall(analysisId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for createExternalTaskVt * @param analysisId (required) @@ -344,272 +209,6 @@ public okhttp3.Call createExternalTaskVtAsync(@javax.annotation.Nonnull Integer localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } - /** - * Build call for getMbData - * @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 -
404 No data retrieved from MalwareBazaar for the given analysis_id -
- */ - public okhttp3.Call getMbDataCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v2/analysis/{analysis_id}/external/mb" - .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 getMbDataValidateBeforeCall(@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 getMbData(Async)"); - } - - return getMbDataCall(analysisId, _callback); - - } - - /** - * Get MalwareBazaar data - * - * @param analysisId (required) - * @return BaseResponseExternalResponse - * @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 -
404 No data retrieved from MalwareBazaar for the given analysis_id -
- */ - public BaseResponseExternalResponse getMbData(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - ApiResponse localVarResp = getMbDataWithHttpInfo(analysisId); - return localVarResp.getData(); - } - - /** - * Get MalwareBazaar data - * - * @param analysisId (required) - * @return ApiResponse<BaseResponseExternalResponse> - * @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 -
404 No data retrieved from MalwareBazaar for the given analysis_id -
- */ - public ApiResponse getMbDataWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - okhttp3.Call localVarCall = getMbDataValidateBeforeCall(analysisId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get MalwareBazaar data (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 -
404 No data retrieved from MalwareBazaar for the given analysis_id -
- */ - public okhttp3.Call getMbDataAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getMbDataValidateBeforeCall(analysisId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for getMbTaskStatus - * @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 getMbTaskStatusCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/v2/analysis/{analysis_id}/external/mb/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 getMbTaskStatusValidateBeforeCall(@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 getMbTaskStatus(Async)"); - } - - return getMbTaskStatusCall(analysisId, _callback); - - } - - /** - * Check the status of MalwareBazaar data retrieval - * - * @param analysisId (required) - * @return BaseResponseTaskResponse - * @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 BaseResponseTaskResponse getMbTaskStatus(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - ApiResponse localVarResp = getMbTaskStatusWithHttpInfo(analysisId); - return localVarResp.getData(); - } - - /** - * Check the status of MalwareBazaar data retrieval - * - * @param analysisId (required) - * @return ApiResponse<BaseResponseTaskResponse> - * @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 getMbTaskStatusWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { - okhttp3.Call localVarCall = getMbTaskStatusValidateBeforeCall(analysisId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Check the status of MalwareBazaar data retrieval (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 getMbTaskStatusAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getMbTaskStatusValidateBeforeCall(analysisId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for getVtData * @param analysisId (required) diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index a50b4ba..6ee9168 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/2.63.0/java"); + setUserAgent("OpenAPI-Generator/2.66.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 1f8b446..75975b0 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 = "2.63.0"; + public static final String VERSION = "2.66.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 6b2a79f..e81876d 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -108,6 +108,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionMapping.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionMatchingRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionsList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisRecord.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTags.CustomTypeAdapterFactory()); @@ -125,6 +126,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisDetailResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisFunctionMapping.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisFunctions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisFunctionsList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisTags.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisUpdateTagsResponse.CustomTypeAdapterFactory()); @@ -257,6 +259,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionInfoInput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionInfoInputFuncDepsInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionInfoOutput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionListItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionLocalVariableResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionMapping.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionMappingFull.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AnalysisFunctionsList.java b/src/main/java/ai/reveng/model/AnalysisFunctionsList.java new file mode 100644 index 0000000..783585b --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisFunctionsList.java @@ -0,0 +1,312 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * 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.FunctionListItem; +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; + +/** + * API response schema for paginated functions list + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisFunctionsList { + public static final String SERIALIZED_NAME_FUNCTIONS = "functions"; + @SerializedName(SERIALIZED_NAME_FUNCTIONS) + @javax.annotation.Nonnull + private List functions = new ArrayList<>(); + + public AnalysisFunctionsList() { + } + + public AnalysisFunctionsList functions(@javax.annotation.Nonnull List functions) { + this.functions = functions; + return this; + } + + public AnalysisFunctionsList addFunctionsItem(FunctionListItem functionsItem) { + if (this.functions == null) { + this.functions = new ArrayList<>(); + } + this.functions.add(functionsItem); + return this; + } + + /** + * The functions associated with the analysis + * @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 AnalysisFunctionsList instance itself + */ + public AnalysisFunctionsList 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; + } + AnalysisFunctionsList analysisFunctionsList = (AnalysisFunctionsList) o; + return Objects.equals(this.functions, analysisFunctionsList.functions)&& + Objects.equals(this.additionalProperties, analysisFunctionsList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(functions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisFunctionsList {\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("functions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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 AnalysisFunctionsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisFunctionsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AnalysisFunctionsList is not found in the empty JSON string", AnalysisFunctionsList.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisFunctionsList.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("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++) { + FunctionListItem.validateJsonElement(jsonArrayfunctions.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisFunctionsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisFunctionsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisFunctionsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisFunctionsList 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 AnalysisFunctionsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalysisFunctionsList 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 AnalysisFunctionsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisFunctionsList + * @throws IOException if the JSON string is invalid with respect to AnalysisFunctionsList + */ + public static AnalysisFunctionsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisFunctionsList.class); + } + + /** + * Convert an instance of AnalysisFunctionsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponseAnalysisFunctionsList.java b/src/main/java/ai/reveng/model/BaseResponseAnalysisFunctionsList.java new file mode 100644 index 0000000..a82b9e6 --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseAnalysisFunctionsList.java @@ -0,0 +1,438 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * 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.AnalysisFunctionsList; +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; + +/** + * BaseResponseAnalysisFunctionsList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseAnalysisFunctionsList { + 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 AnalysisFunctionsList 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 BaseResponseAnalysisFunctionsList() { + } + + public BaseResponseAnalysisFunctionsList 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 BaseResponseAnalysisFunctionsList data(@javax.annotation.Nullable AnalysisFunctionsList data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public AnalysisFunctionsList getData() { + return data; + } + + public void setData(@javax.annotation.Nullable AnalysisFunctionsList data) { + this.data = data; + } + + + public BaseResponseAnalysisFunctionsList 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 BaseResponseAnalysisFunctionsList errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseAnalysisFunctionsList 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 BaseResponseAnalysisFunctionsList 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 BaseResponseAnalysisFunctionsList instance itself + */ + public BaseResponseAnalysisFunctionsList 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; + } + BaseResponseAnalysisFunctionsList baseResponseAnalysisFunctionsList = (BaseResponseAnalysisFunctionsList) o; + return Objects.equals(this.status, baseResponseAnalysisFunctionsList.status) && + Objects.equals(this.data, baseResponseAnalysisFunctionsList.data) && + Objects.equals(this.message, baseResponseAnalysisFunctionsList.message) && + Objects.equals(this.errors, baseResponseAnalysisFunctionsList.errors) && + Objects.equals(this.meta, baseResponseAnalysisFunctionsList.meta)&& + Objects.equals(this.additionalProperties, baseResponseAnalysisFunctionsList.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 BaseResponseAnalysisFunctionsList {\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 BaseResponseAnalysisFunctionsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseAnalysisFunctionsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseAnalysisFunctionsList is not found in the empty JSON string", BaseResponseAnalysisFunctionsList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `data` + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + AnalysisFunctionsList.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 (!BaseResponseAnalysisFunctionsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseAnalysisFunctionsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseAnalysisFunctionsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseAnalysisFunctionsList 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 BaseResponseAnalysisFunctionsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseAnalysisFunctionsList 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 BaseResponseAnalysisFunctionsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseAnalysisFunctionsList + * @throws IOException if the JSON string is invalid with respect to BaseResponseAnalysisFunctionsList + */ + public static BaseResponseAnalysisFunctionsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseAnalysisFunctionsList.class); + } + + /** + * Convert an instance of BaseResponseAnalysisFunctionsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionListItem.java b/src/main/java/ai/reveng/model/FunctionListItem.java new file mode 100644 index 0000000..3549399 --- /dev/null +++ b/src/main/java/ai/reveng/model/FunctionListItem.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * 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; + +/** + * FunctionListItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FunctionListItem { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private Long id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_MANGLED_NAME = "mangled_name"; + @SerializedName(SERIALIZED_NAME_MANGLED_NAME) + @javax.annotation.Nonnull + private String mangledName; + + public static final String SERIALIZED_NAME_VADDR = "vaddr"; + @SerializedName(SERIALIZED_NAME_VADDR) + @javax.annotation.Nonnull + private Long vaddr; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Integer size; + + public static final String SERIALIZED_NAME_DEBUG = "debug"; + @SerializedName(SERIALIZED_NAME_DEBUG) + @javax.annotation.Nonnull + private Boolean debug; + + public FunctionListItem() { + } + + public FunctionListItem id(@javax.annotation.Nonnull Long id) { + this.id = id; + return this; + } + + /** + * Function id + * @return id + */ + @javax.annotation.Nonnull + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull Long id) { + this.id = id; + } + + + public FunctionListItem name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Name of the function + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public FunctionListItem mangledName(@javax.annotation.Nonnull String mangledName) { + this.mangledName = mangledName; + return this; + } + + /** + * Mangled name of the function + * @return mangledName + */ + @javax.annotation.Nonnull + public String getMangledName() { + return mangledName; + } + + public void setMangledName(@javax.annotation.Nonnull String mangledName) { + this.mangledName = mangledName; + } + + + public FunctionListItem vaddr(@javax.annotation.Nonnull Long vaddr) { + this.vaddr = vaddr; + return this; + } + + /** + * Function virtual address + * @return vaddr + */ + @javax.annotation.Nonnull + public Long getVaddr() { + return vaddr; + } + + public void setVaddr(@javax.annotation.Nonnull Long vaddr) { + this.vaddr = vaddr; + } + + + public FunctionListItem size(@javax.annotation.Nonnull Integer size) { + this.size = size; + return this; + } + + /** + * Function size in bytes + * @return size + */ + @javax.annotation.Nonnull + public Integer getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Integer size) { + this.size = size; + } + + + public FunctionListItem debug(@javax.annotation.Nonnull Boolean debug) { + this.debug = debug; + return this; + } + + /** + * Whether the function has debug information + * @return debug + */ + @javax.annotation.Nonnull + public Boolean getDebug() { + return debug; + } + + public void setDebug(@javax.annotation.Nonnull Boolean debug) { + this.debug = debug; + } + + /** + * 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 FunctionListItem instance itself + */ + public FunctionListItem 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; + } + FunctionListItem functionListItem = (FunctionListItem) o; + return Objects.equals(this.id, functionListItem.id) && + Objects.equals(this.name, functionListItem.name) && + Objects.equals(this.mangledName, functionListItem.mangledName) && + Objects.equals(this.vaddr, functionListItem.vaddr) && + Objects.equals(this.size, functionListItem.size) && + Objects.equals(this.debug, functionListItem.debug)&& + Objects.equals(this.additionalProperties, functionListItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, mangledName, vaddr, size, debug, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionListItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" mangledName: ").append(toIndentedString(mangledName)).append("\n"); + sb.append(" vaddr: ").append(toIndentedString(vaddr)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" debug: ").append(toIndentedString(debug)).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", "name", "mangled_name", "vaddr", "size", "debug")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("id", "name", "mangled_name", "vaddr", "size", "debug")); + } + + /** + * 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 FunctionListItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionListItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in FunctionListItem is not found in the empty JSON string", FunctionListItem.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionListItem.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("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("mangled_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `mangled_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mangled_name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionListItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionListItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FunctionListItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionListItem 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 FunctionListItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FunctionListItem 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 FunctionListItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionListItem + * @throws IOException if the JSON string is invalid with respect to FunctionListItem + */ + public static FunctionListItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionListItem.class); + } + + /** + * Convert an instance of FunctionListItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/test/java/ai/reveng/api/AnalysesResultsMetadataApiTest.java b/src/test/java/ai/reveng/api/AnalysesResultsMetadataApiTest.java index a4073b7..6cfb30a 100644 --- a/src/test/java/ai/reveng/api/AnalysesResultsMetadataApiTest.java +++ b/src/test/java/ai/reveng/api/AnalysesResultsMetadataApiTest.java @@ -15,6 +15,7 @@ import ai.reveng.invoker.ApiException; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseAnalysisFunctions; +import ai.reveng.model.BaseResponseAnalysisFunctionsList; import ai.reveng.model.BaseResponseAnalysisTags; import ai.reveng.model.BaseResponseCapabilities; import ai.reveng.model.BaseResponseCommunities; @@ -36,6 +37,22 @@ public class AnalysesResultsMetadataApiTest { private final AnalysesResultsMetadataApi api = new AnalysesResultsMetadataApi(); + /** + * Get functions from analysis + * + * Returns a paginated list of functions identified during analysis + * + * @throws ApiException if the Api call fails + */ + @Test + public void getAnalysisFunctionsPaginatedTest() throws ApiException { + Integer analysisId = null; + Integer page = null; + Integer pageSize = null; + BaseResponseAnalysisFunctionsList response = api.getAnalysisFunctionsPaginated(analysisId, page, pageSize); + // TODO: test validations + } + /** * Gets the capabilities from the analysis * diff --git a/src/test/java/ai/reveng/api/ExternalSourcesApiTest.java b/src/test/java/ai/reveng/api/ExternalSourcesApiTest.java index a84dc8f..58058d6 100644 --- a/src/test/java/ai/reveng/api/ExternalSourcesApiTest.java +++ b/src/test/java/ai/reveng/api/ExternalSourcesApiTest.java @@ -33,18 +33,6 @@ public class ExternalSourcesApiTest { private final ExternalSourcesApi api = new ExternalSourcesApi(); - /** - * Pulls data from VirusTotal - * - * @throws ApiException if the Api call fails - */ - @Test - public void createExternalTaskMbTest() throws ApiException { - Integer analysisId = null; - BaseResponseStr response = api.createExternalTaskMb(analysisId); - // TODO: test validations - } - /** * Pulls data from VirusTotal * @@ -57,30 +45,6 @@ public void createExternalTaskVtTest() throws ApiException { // TODO: test validations } - /** - * Get MalwareBazaar data - * - * @throws ApiException if the Api call fails - */ - @Test - public void getMbDataTest() throws ApiException { - Integer analysisId = null; - BaseResponseExternalResponse response = api.getMbData(analysisId); - // TODO: test validations - } - - /** - * Check the status of MalwareBazaar data retrieval - * - * @throws ApiException if the Api call fails - */ - @Test - public void getMbTaskStatusTest() throws ApiException { - Integer analysisId = null; - BaseResponseTaskResponse response = api.getMbTaskStatus(analysisId); - // TODO: test validations - } - /** * Get VirusTotal data * diff --git a/src/test/java/ai/reveng/model/AnalysisFunctionsListTest.java b/src/test/java/ai/reveng/model/AnalysisFunctionsListTest.java new file mode 100644 index 0000000..0cfc304 --- /dev/null +++ b/src/test/java/ai/reveng/model/AnalysisFunctionsListTest.java @@ -0,0 +1,50 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * 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 ai.reveng.model.FunctionListItem; +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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for AnalysisFunctionsList + */ +public class AnalysisFunctionsListTest { + private final AnalysisFunctionsList model = new AnalysisFunctionsList(); + + /** + * Model tests for AnalysisFunctionsList + */ + @Test + public void testAnalysisFunctionsList() { + // TODO: test AnalysisFunctionsList + } + + /** + * Test the property 'functions' + */ + @Test + public void functionsTest() { + // TODO: test functions + } + +} diff --git a/src/test/java/ai/reveng/model/BaseResponseAnalysisFunctionsListTest.java b/src/test/java/ai/reveng/model/BaseResponseAnalysisFunctionsListTest.java new file mode 100644 index 0000000..9beea2d --- /dev/null +++ b/src/test/java/ai/reveng/model/BaseResponseAnalysisFunctionsListTest.java @@ -0,0 +1,85 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * 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 ai.reveng.model.AnalysisFunctionsList; +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 org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BaseResponseAnalysisFunctionsList + */ +public class BaseResponseAnalysisFunctionsListTest { + private final BaseResponseAnalysisFunctionsList model = new BaseResponseAnalysisFunctionsList(); + + /** + * Model tests for BaseResponseAnalysisFunctionsList + */ + @Test + public void testBaseResponseAnalysisFunctionsList() { + // TODO: test BaseResponseAnalysisFunctionsList + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'data' + */ + @Test + public void dataTest() { + // TODO: test data + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + + /** + * Test the property 'errors' + */ + @Test + public void errorsTest() { + // TODO: test errors + } + + /** + * Test the property 'meta' + */ + @Test + public void metaTest() { + // TODO: test meta + } + +} diff --git a/src/test/java/ai/reveng/model/FunctionListItemTest.java b/src/test/java/ai/reveng/model/FunctionListItemTest.java new file mode 100644 index 0000000..810e904 --- /dev/null +++ b/src/test/java/ai/reveng/model/FunctionListItemTest.java @@ -0,0 +1,87 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * 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 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.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FunctionListItem + */ +public class FunctionListItemTest { + private final FunctionListItem model = new FunctionListItem(); + + /** + * Model tests for FunctionListItem + */ + @Test + public void testFunctionListItem() { + // TODO: test FunctionListItem + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'mangledName' + */ + @Test + public void mangledNameTest() { + // TODO: test mangledName + } + + /** + * Test the property 'vaddr' + */ + @Test + public void vaddrTest() { + // TODO: test vaddr + } + + /** + * Test the property 'size' + */ + @Test + public void sizeTest() { + // TODO: test size + } + + /** + * Test the property 'debug' + */ + @Test + public void debugTest() { + // TODO: test debug + } + +}