diff --git a/.sdk-version b/.sdk-version index 0c29db7..d5475e2 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v2.16.0 +v2.18.2 diff --git a/README.md b/README.md index 4cb13e9..29a2a6e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 2.16.0 + 2.18.2 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:2.16.0" + implementation "ai.reveng:sdk:2.18.2" } ``` @@ -168,12 +168,9 @@ Class | Method | HTTP request | Description *FunctionsDataTypesApi* | [**listFunctionDataTypesForAnalysis**](docs/FunctionsDataTypesApi.md#listFunctionDataTypesForAnalysis) | **GET** /v2/analyses/{analysis_id}/functions/data_types | List Function Data Types *FunctionsDataTypesApi* | [**listFunctionDataTypesForFunctions**](docs/FunctionsDataTypesApi.md#listFunctionDataTypesForFunctions) | **GET** /v2/functions/data_types | List Function Data Types *FunctionsDataTypesApi* | [**updateFunctionDataTypes**](docs/FunctionsDataTypesApi.md#updateFunctionDataTypes) | **PUT** /v2/analyses/{analysis_id}/functions/{function_id}/data_types | Update Function Data Types -*FunctionsDecompilationApi* | [**checkFunctionDecompilationTask**](docs/FunctionsDecompilationApi.md#checkFunctionDecompilationTask) | **GET** /v2/functions/{function_id}/decompilation/status | Check the status of a function decompilation *FunctionsDecompilationApi* | [**createDecompilationComment**](docs/FunctionsDecompilationApi.md#createDecompilationComment) | **POST** /v2/functions/{function_id}/decompilation/comments | Create a comment for this function -*FunctionsDecompilationApi* | [**createFunctionDecompilationTask**](docs/FunctionsDecompilationApi.md#createFunctionDecompilationTask) | **POST** /v2/functions/{function_id}/decompilation | Queues a function decompilation *FunctionsDecompilationApi* | [**deleteDecompilationComment**](docs/FunctionsDecompilationApi.md#deleteDecompilationComment) | **DELETE** /v2/functions/{function_id}/decompilation/comments/{comment_id} | Delete a comment *FunctionsDecompilationApi* | [**getDecompilationComments**](docs/FunctionsDecompilationApi.md#getDecompilationComments) | **GET** /v2/functions/{function_id}/decompilation/comments | Get comments for this function -*FunctionsDecompilationApi* | [**getFunctionDecompilation**](docs/FunctionsDecompilationApi.md#getFunctionDecompilation) | **GET** /v2/functions/{function_id}/decompilation | Get decompilation result *FunctionsDecompilationApi* | [**updateDecompilationComment**](docs/FunctionsDecompilationApi.md#updateDecompilationComment) | **PATCH** /v2/functions/{function_id}/decompilation/comments/{comment_id} | Update a comment *FunctionsRenamingHistoryApi* | [**batchRenameFunction**](docs/FunctionsRenamingHistoryApi.md#batchRenameFunction) | **POST** /v2/functions/rename/batch | Batch Rename Functions *FunctionsRenamingHistoryApi* | [**getFunctionNameHistory**](docs/FunctionsRenamingHistoryApi.md#getFunctionNameHistory) | **GET** /v2/functions/history/{function_id} | Get Function Name History @@ -245,7 +242,6 @@ Class | Method | HTTP request | Description - [BaseResponseCommentResponse](docs/BaseResponseCommentResponse.md) - [BaseResponseCommunities](docs/BaseResponseCommunities.md) - [BaseResponseCreated](docs/BaseResponseCreated.md) - - [BaseResponseDecompilationResponse](docs/BaseResponseDecompilationResponse.md) - [BaseResponseDict](docs/BaseResponseDict.md) - [BaseResponseDynamicExecutionStatus](docs/BaseResponseDynamicExecutionStatus.md) - [BaseResponseExternalResponse](docs/BaseResponseExternalResponse.md) @@ -332,7 +328,6 @@ Class | Method | HTTP request | Description - [Context](docs/Context.md) - [Created](docs/Created.md) - [DecompilationCommentContext](docs/DecompilationCommentContext.md) - - [DecompilationResponse](docs/DecompilationResponse.md) - [DieMatch](docs/DieMatch.md) - [DynamicExecutionStatusInput](docs/DynamicExecutionStatusInput.md) - [ELFImportModel](docs/ELFImportModel.md) diff --git a/build.gradle b/build.gradle index e635df3..60c697c 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '2.16.0' +version = '2.18.2' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "2.16.0") + coordinates("ai.reveng", "sdk", "2.18.2") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 097a206..c7337aa 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.16.0", + version := "2.18.2", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/BaseResponseDecompilationResponse.md b/docs/BaseResponseDecompilationResponse.md deleted file mode 100644 index 0208e42..0000000 --- a/docs/BaseResponseDecompilationResponse.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# BaseResponseDecompilationResponse - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**DecompilationResponse**](DecompilationResponse.md) | | [optional] | -|**message** | **String** | | [optional] | -|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | -|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | - - - diff --git a/docs/DecompilationResponse.md b/docs/DecompilationResponse.md deleted file mode 100644 index 9b4546e..0000000 --- a/docs/DecompilationResponse.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# DecompilationResponse - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**functionId** | **Long** | The ID of the function | | -|**decompilation** | **String** | | | -|**callingConvention** | **String** | | | - - - diff --git a/docs/FunctionsDecompilationApi.md b/docs/FunctionsDecompilationApi.md index 102f461..f131a8a 100644 --- a/docs/FunctionsDecompilationApi.md +++ b/docs/FunctionsDecompilationApi.md @@ -4,83 +4,12 @@ All URIs are relative to *https://api.reveng.ai* | Method | HTTP request | Description | |------------- | ------------- | -------------| -| [**checkFunctionDecompilationTask**](FunctionsDecompilationApi.md#checkFunctionDecompilationTask) | **GET** /v2/functions/{function_id}/decompilation/status | Check the status of a function decompilation | | [**createDecompilationComment**](FunctionsDecompilationApi.md#createDecompilationComment) | **POST** /v2/functions/{function_id}/decompilation/comments | Create a comment for this function | -| [**createFunctionDecompilationTask**](FunctionsDecompilationApi.md#createFunctionDecompilationTask) | **POST** /v2/functions/{function_id}/decompilation | Queues a function decompilation | | [**deleteDecompilationComment**](FunctionsDecompilationApi.md#deleteDecompilationComment) | **DELETE** /v2/functions/{function_id}/decompilation/comments/{comment_id} | Delete a comment | | [**getDecompilationComments**](FunctionsDecompilationApi.md#getDecompilationComments) | **GET** /v2/functions/{function_id}/decompilation/comments | Get comments for this function | -| [**getFunctionDecompilation**](FunctionsDecompilationApi.md#getFunctionDecompilation) | **GET** /v2/functions/{function_id}/decompilation | Get decompilation result | | [**updateDecompilationComment**](FunctionsDecompilationApi.md#updateDecompilationComment) | **PATCH** /v2/functions/{function_id}/decompilation/comments/{comment_id} | Update a comment | - -# **checkFunctionDecompilationTask** -> BaseResponseFunctionTaskResponse checkFunctionDecompilationTask(functionId) - -Check the status of a function decompilation - -### 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.FunctionsDecompilationApi; - -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"); - - FunctionsDecompilationApi apiInstance = new FunctionsDecompilationApi(defaultClient); - Integer functionId = 56; // Integer | - try { - BaseResponseFunctionTaskResponse result = apiInstance.checkFunctionDecompilationTask(functionId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDecompilationApi#checkFunctionDecompilationTask"); - 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 | -|------------- | ------------- | ------------- | -------------| -| **functionId** | **Integer**| | | - -### Return type - -[**BaseResponseFunctionTaskResponse**](BaseResponseFunctionTaskResponse.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 | - | - # **createDecompilationComment** > BaseResponseCommentResponse createDecompilationComment(functionId, functionCommentCreateRequest) @@ -154,75 +83,6 @@ public class Example { | **422** | Invalid request parameters | - | | **400** | Bad Request | - | - -# **createFunctionDecompilationTask** -> BaseResponseStr createFunctionDecompilationTask(functionId) - -Queues a function decompilation - -### 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.FunctionsDecompilationApi; - -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"); - - FunctionsDecompilationApi apiInstance = new FunctionsDecompilationApi(defaultClient); - Integer functionId = 56; // Integer | - try { - BaseResponseStr result = apiInstance.createFunctionDecompilationTask(functionId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDecompilationApi#createFunctionDecompilationTask"); - 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 | -|------------- | ------------- | ------------- | -------------| -| **functionId** | **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** | Security checks already extracted or queued | - | - # **deleteDecompilationComment** > BaseResponseBool deleteDecompilationComment(commentId, functionId) @@ -367,75 +227,6 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | - -# **getFunctionDecompilation** -> BaseResponseDecompilationResponse getFunctionDecompilation(functionId) - -Get decompilation result - -### Example -```java -// Import classes: -import ai.reveng.invoker.ApiClient; -import ai.reveng.invoker.ApiException; -import ai.reveng.invoker.Configuration; -import ai.reveng.invoker.auth.*; -import ai.reveng.invoker.models.*; -import ai.reveng.api.FunctionsDecompilationApi; - -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"); - - FunctionsDecompilationApi apiInstance = new FunctionsDecompilationApi(defaultClient); - Integer functionId = 56; // Integer | - try { - BaseResponseDecompilationResponse result = apiInstance.getFunctionDecompilation(functionId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDecompilationApi#getFunctionDecompilation"); - 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 | -|------------- | ------------- | ------------- | -------------| -| **functionId** | **Integer**| | | - -### Return type - -[**BaseResponseDecompilationResponse**](BaseResponseDecompilationResponse.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** | Unable to find a decompilation for the function_id given | - | - # **updateDecompilationComment** > BaseResponseCommentResponse updateDecompilationComment(commentId, functionId, commentUpdateRequest) diff --git a/docs/ModelName.md b/docs/ModelName.md index a336819..add775e 100644 --- a/docs/ModelName.md +++ b/docs/ModelName.md @@ -5,21 +5,17 @@ ## Enum -* `BINNET_0_5_X86_WINDOWS` (value: `"binnet-0.5-x86-windows"`) +* `BINNET_0_7_X86_64_WINDOWS` (value: `"binnet-0.7-x86-64-windows"`) -* `BINNET_0_5_X86_LINUX` (value: `"binnet-0.5-x86-linux"`) +* `BINNET_0_7_X86_64_LINUX` (value: `"binnet-0.7-x86-64-linux"`) -* `BINNET_0_5_X86_MACOS` (value: `"binnet-0.5-x86-macos"`) +* `BINNET_0_7_X86_32_WINDOWS` (value: `"binnet-0.7-x86-32-windows"`) -* `BINNET_0_5_X86_ANDROID` (value: `"binnet-0.5-x86-android"`) +* `BINNET_0_7_X86_32_LINUX` (value: `"binnet-0.7-x86-32-linux"`) -* `BINNET_0_5_X86_32_WINDOWS` (value: `"binnet-0.5-x86-32-windows"`) +* `BINNET_0_7_ARM_64_WINDOWS` (value: `"binnet-0.7-arm-64-windows"`) -* `BINNET_0_5_X86_32_LINUX` (value: `"binnet-0.5-x86-32-linux"`) - -* `BINNET_0_5_ARM_64_WINDOWS` (value: `"binnet-0.5-arm-64-windows"`) - -* `BINNET_0_5_ARM_64_LINUX` (value: `"binnet-0.5-arm-64-linux"`) +* `BINNET_0_7_ARM_64_LINUX` (value: `"binnet-0.7-arm-64-linux"`) diff --git a/pom.xml b/pom.xml index f91cfa8..9139486 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 2.16.0 + 2.18.2 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/FunctionsDecompilationApi.java b/src/main/java/ai/reveng/api/FunctionsDecompilationApi.java index b6fbdcd..db7ffbe 100644 --- a/src/main/java/ai/reveng/api/FunctionsDecompilationApi.java +++ b/src/main/java/ai/reveng/api/FunctionsDecompilationApi.java @@ -29,10 +29,7 @@ import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseBool; import ai.reveng.model.BaseResponseCommentResponse; -import ai.reveng.model.BaseResponseDecompilationResponse; -import ai.reveng.model.BaseResponseFunctionTaskResponse; import ai.reveng.model.BaseResponseListCommentResponse; -import ai.reveng.model.BaseResponseStr; import ai.reveng.model.CommentUpdateRequest; import ai.reveng.model.FunctionCommentCreateRequest; @@ -79,137 +76,6 @@ public void setCustomBaseUrl(String customBaseUrl) { this.localCustomBaseUrl = customBaseUrl; } - /** - * Build call for checkFunctionDecompilationTask - * @param functionId (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 checkFunctionDecompilationTaskCall(@javax.annotation.Nonnull Integer functionId, 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/functions/{function_id}/decompilation/status" - .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.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 checkFunctionDecompilationTaskValidateBeforeCall(@javax.annotation.Nonnull Integer functionId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'functionId' is set - if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling checkFunctionDecompilationTask(Async)"); - } - - return checkFunctionDecompilationTaskCall(functionId, _callback); - - } - - /** - * Check the status of a function decompilation - * - * @param functionId (required) - * @return BaseResponseFunctionTaskResponse - * @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 BaseResponseFunctionTaskResponse checkFunctionDecompilationTask(@javax.annotation.Nonnull Integer functionId) throws ApiException { - ApiResponse localVarResp = checkFunctionDecompilationTaskWithHttpInfo(functionId); - return localVarResp.getData(); - } - - /** - * Check the status of a function decompilation - * - * @param functionId (required) - * @return ApiResponse<BaseResponseFunctionTaskResponse> - * @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 checkFunctionDecompilationTaskWithHttpInfo(@javax.annotation.Nonnull Integer functionId) throws ApiException { - okhttp3.Call localVarCall = checkFunctionDecompilationTaskValidateBeforeCall(functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Check the status of a function decompilation (asynchronously) - * - * @param functionId (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 checkFunctionDecompilationTaskAsync(@javax.annotation.Nonnull Integer functionId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = checkFunctionDecompilationTaskValidateBeforeCall(functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for createDecompilationComment * @param functionId (required) @@ -355,141 +221,6 @@ public okhttp3.Call createDecompilationCommentAsync(@javax.annotation.Nonnull In localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } - /** - * Build call for createFunctionDecompilationTask - * @param functionId (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 Security checks already extracted or queued -
- */ - public okhttp3.Call createFunctionDecompilationTaskCall(@javax.annotation.Nonnull Integer functionId, 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/functions/{function_id}/decompilation" - .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.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 createFunctionDecompilationTaskValidateBeforeCall(@javax.annotation.Nonnull Integer functionId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'functionId' is set - if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling createFunctionDecompilationTask(Async)"); - } - - return createFunctionDecompilationTaskCall(functionId, _callback); - - } - - /** - * Queues a function decompilation - * - * @param functionId (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 Security checks already extracted or queued -
- */ - public BaseResponseStr createFunctionDecompilationTask(@javax.annotation.Nonnull Integer functionId) throws ApiException { - ApiResponse localVarResp = createFunctionDecompilationTaskWithHttpInfo(functionId); - return localVarResp.getData(); - } - - /** - * Queues a function decompilation - * - * @param functionId (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 Security checks already extracted or queued -
- */ - public ApiResponse createFunctionDecompilationTaskWithHttpInfo(@javax.annotation.Nonnull Integer functionId) throws ApiException { - okhttp3.Call localVarCall = createFunctionDecompilationTaskValidateBeforeCall(functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Queues a function decompilation (asynchronously) - * - * @param functionId (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 Security checks already extracted or queued -
- */ - public okhttp3.Call createFunctionDecompilationTaskAsync(@javax.annotation.Nonnull Integer functionId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createFunctionDecompilationTaskValidateBeforeCall(functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for deleteDecompilationComment * @param commentId (required) @@ -770,141 +501,6 @@ public okhttp3.Call getDecompilationCommentsAsync(@javax.annotation.Nonnull Inte localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } - /** - * Build call for getFunctionDecompilation - * @param functionId (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 Unable to find a decompilation for the function_id given -
- */ - public okhttp3.Call getFunctionDecompilationCall(@javax.annotation.Nonnull Integer functionId, 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/functions/{function_id}/decompilation" - .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.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 getFunctionDecompilationValidateBeforeCall(@javax.annotation.Nonnull Integer functionId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'functionId' is set - if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling getFunctionDecompilation(Async)"); - } - - return getFunctionDecompilationCall(functionId, _callback); - - } - - /** - * Get decompilation result - * - * @param functionId (required) - * @return BaseResponseDecompilationResponse - * @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 Unable to find a decompilation for the function_id given -
- */ - public BaseResponseDecompilationResponse getFunctionDecompilation(@javax.annotation.Nonnull Integer functionId) throws ApiException { - ApiResponse localVarResp = getFunctionDecompilationWithHttpInfo(functionId); - return localVarResp.getData(); - } - - /** - * Get decompilation result - * - * @param functionId (required) - * @return ApiResponse<BaseResponseDecompilationResponse> - * @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 Unable to find a decompilation for the function_id given -
- */ - public ApiResponse getFunctionDecompilationWithHttpInfo(@javax.annotation.Nonnull Integer functionId) throws ApiException { - okhttp3.Call localVarCall = getFunctionDecompilationValidateBeforeCall(functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get decompilation result (asynchronously) - * - * @param functionId (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 Unable to find a decompilation for the function_id given -
- */ - public okhttp3.Call getFunctionDecompilationAsync(@javax.annotation.Nonnull Integer functionId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getFunctionDecompilationValidateBeforeCall(functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for updateDecompilationComment * @param commentId (required) diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 0ca80f1..f9781f3 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.16.0/java"); + setUserAgent("OpenAPI-Generator/2.18.2/java"); authentications = new HashMap(); } diff --git a/src/main/java/ai/reveng/invoker/Configuration.java b/src/main/java/ai/reveng/invoker/Configuration.java index 11b225d..b216aab 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.16.0"; + public static final String VERSION = "2.18.2"; private static final AtomicReference defaultApiClient = new AtomicReference<>(); private static volatile Supplier apiClientFactory = ApiClient::new; diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index 469a87f..26570e6 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -150,7 +150,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCommentResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCommunities.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseCreated.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseDecompilationResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseDict.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseDynamicExecutionStatus.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseExternalResponse.CustomTypeAdapterFactory()); @@ -234,7 +233,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Context.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Created.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompilationCommentContext.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompilationResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DieMatch.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFImportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFModel.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/BaseResponseDecompilationResponse.java b/src/main/java/ai/reveng/model/BaseResponseDecompilationResponse.java deleted file mode 100644 index c8e3c1b..0000000 --- a/src/main/java/ai/reveng/model/BaseResponseDecompilationResponse.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * 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.DecompilationResponse; -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; - -/** - * BaseResponseDecompilationResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseDecompilationResponse { - 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 DecompilationResponse 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 BaseResponseDecompilationResponse() { - } - - public BaseResponseDecompilationResponse 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 BaseResponseDecompilationResponse data(@javax.annotation.Nullable DecompilationResponse data) { - this.data = data; - return this; - } - - /** - * Get data - * @return data - */ - @javax.annotation.Nullable - public DecompilationResponse getData() { - return data; - } - - public void setData(@javax.annotation.Nullable DecompilationResponse data) { - this.data = data; - } - - - public BaseResponseDecompilationResponse 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 BaseResponseDecompilationResponse errors(@javax.annotation.Nullable List errors) { - this.errors = errors; - return this; - } - - public BaseResponseDecompilationResponse 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 BaseResponseDecompilationResponse 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 BaseResponseDecompilationResponse instance itself - */ - public BaseResponseDecompilationResponse 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; - } - BaseResponseDecompilationResponse baseResponseDecompilationResponse = (BaseResponseDecompilationResponse) o; - return Objects.equals(this.status, baseResponseDecompilationResponse.status) && - Objects.equals(this.data, baseResponseDecompilationResponse.data) && - Objects.equals(this.message, baseResponseDecompilationResponse.message) && - Objects.equals(this.errors, baseResponseDecompilationResponse.errors) && - Objects.equals(this.meta, baseResponseDecompilationResponse.meta)&& - Objects.equals(this.additionalProperties, baseResponseDecompilationResponse.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 BaseResponseDecompilationResponse {\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 BaseResponseDecompilationResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BaseResponseDecompilationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseDecompilationResponse is not found in the empty JSON string", BaseResponseDecompilationResponse.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - DecompilationResponse.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 (!BaseResponseDecompilationResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseDecompilationResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseDecompilationResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BaseResponseDecompilationResponse 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 BaseResponseDecompilationResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - BaseResponseDecompilationResponse 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 BaseResponseDecompilationResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of BaseResponseDecompilationResponse - * @throws IOException if the JSON string is invalid with respect to BaseResponseDecompilationResponse - */ - public static BaseResponseDecompilationResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseDecompilationResponse.class); - } - - /** - * Convert an instance of BaseResponseDecompilationResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/DecompilationResponse.java b/src/main/java/ai/reveng/model/DecompilationResponse.java deleted file mode 100644 index 1ce9cef..0000000 --- a/src/main/java/ai/reveng/model/DecompilationResponse.java +++ /dev/null @@ -1,349 +0,0 @@ -/* - * 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; - -/** - * DecompilationResponse - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class DecompilationResponse { - public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; - @SerializedName(SERIALIZED_NAME_FUNCTION_ID) - @javax.annotation.Nonnull - private Long functionId; - - public static final String SERIALIZED_NAME_DECOMPILATION = "decompilation"; - @SerializedName(SERIALIZED_NAME_DECOMPILATION) - @javax.annotation.Nonnull - private String decompilation; - - public static final String SERIALIZED_NAME_CALLING_CONVENTION = "calling_convention"; - @SerializedName(SERIALIZED_NAME_CALLING_CONVENTION) - @javax.annotation.Nonnull - private String callingConvention; - - public DecompilationResponse() { - } - - public DecompilationResponse functionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - return this; - } - - /** - * The ID of the function - * @return functionId - */ - @javax.annotation.Nonnull - public Long getFunctionId() { - return functionId; - } - - public void setFunctionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - } - - - public DecompilationResponse decompilation(@javax.annotation.Nonnull String decompilation) { - this.decompilation = decompilation; - return this; - } - - /** - * Get decompilation - * @return decompilation - */ - @javax.annotation.Nonnull - public String getDecompilation() { - return decompilation; - } - - public void setDecompilation(@javax.annotation.Nonnull String decompilation) { - this.decompilation = decompilation; - } - - - public DecompilationResponse callingConvention(@javax.annotation.Nonnull String callingConvention) { - this.callingConvention = callingConvention; - return this; - } - - /** - * Get callingConvention - * @return callingConvention - */ - @javax.annotation.Nonnull - public String getCallingConvention() { - return callingConvention; - } - - public void setCallingConvention(@javax.annotation.Nonnull String callingConvention) { - this.callingConvention = callingConvention; - } - - /** - * 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 DecompilationResponse instance itself - */ - public DecompilationResponse 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; - } - DecompilationResponse decompilationResponse = (DecompilationResponse) o; - return Objects.equals(this.functionId, decompilationResponse.functionId) && - Objects.equals(this.decompilation, decompilationResponse.decompilation) && - Objects.equals(this.callingConvention, decompilationResponse.callingConvention)&& - Objects.equals(this.additionalProperties, decompilationResponse.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(functionId, decompilation, callingConvention, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DecompilationResponse {\n"); - sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); - sb.append(" decompilation: ").append(toIndentedString(decompilation)).append("\n"); - sb.append(" callingConvention: ").append(toIndentedString(callingConvention)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("function_id", "decompilation", "calling_convention")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("function_id", "decompilation", "calling_convention")); - } - - /** - * 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 DecompilationResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!DecompilationResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DecompilationResponse is not found in the empty JSON string", DecompilationResponse.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DecompilationResponse.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("decompilation").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `decompilation` to be a primitive type in the JSON string but got `%s`", jsonObj.get("decompilation").toString())); - } - if (!jsonObj.get("calling_convention").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `calling_convention` to be a primitive type in the JSON string but got `%s`", jsonObj.get("calling_convention").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DecompilationResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DecompilationResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DecompilationResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, DecompilationResponse 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 DecompilationResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - DecompilationResponse 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 DecompilationResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of DecompilationResponse - * @throws IOException if the JSON string is invalid with respect to DecompilationResponse - */ - public static DecompilationResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DecompilationResponse.class); - } - - /** - * Convert an instance of DecompilationResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/ModelName.java b/src/main/java/ai/reveng/model/ModelName.java index 7719e0e..9d9c997 100644 --- a/src/main/java/ai/reveng/model/ModelName.java +++ b/src/main/java/ai/reveng/model/ModelName.java @@ -30,21 +30,17 @@ @JsonAdapter(ModelName.Adapter.class) public enum ModelName { - BINNET_0_5_X86_WINDOWS("binnet-0.5-x86-windows"), + BINNET_0_7_X86_64_WINDOWS("binnet-0.7-x86-64-windows"), - BINNET_0_5_X86_LINUX("binnet-0.5-x86-linux"), + BINNET_0_7_X86_64_LINUX("binnet-0.7-x86-64-linux"), - BINNET_0_5_X86_MACOS("binnet-0.5-x86-macos"), + BINNET_0_7_X86_32_WINDOWS("binnet-0.7-x86-32-windows"), - BINNET_0_5_X86_ANDROID("binnet-0.5-x86-android"), + BINNET_0_7_X86_32_LINUX("binnet-0.7-x86-32-linux"), - BINNET_0_5_X86_32_WINDOWS("binnet-0.5-x86-32-windows"), + BINNET_0_7_ARM_64_WINDOWS("binnet-0.7-arm-64-windows"), - BINNET_0_5_X86_32_LINUX("binnet-0.5-x86-32-linux"), - - BINNET_0_5_ARM_64_WINDOWS("binnet-0.5-arm-64-windows"), - - BINNET_0_5_ARM_64_LINUX("binnet-0.5-arm-64-linux"); + BINNET_0_7_ARM_64_LINUX("binnet-0.7-arm-64-linux"); private String value; diff --git a/src/test/java/ai/reveng/api/FunctionsDecompilationApiTest.java b/src/test/java/ai/reveng/api/FunctionsDecompilationApiTest.java index 24a9d9b..e61c1fb 100644 --- a/src/test/java/ai/reveng/api/FunctionsDecompilationApiTest.java +++ b/src/test/java/ai/reveng/api/FunctionsDecompilationApiTest.java @@ -16,10 +16,7 @@ import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseBool; import ai.reveng.model.BaseResponseCommentResponse; -import ai.reveng.model.BaseResponseDecompilationResponse; -import ai.reveng.model.BaseResponseFunctionTaskResponse; import ai.reveng.model.BaseResponseListCommentResponse; -import ai.reveng.model.BaseResponseStr; import ai.reveng.model.CommentUpdateRequest; import ai.reveng.model.FunctionCommentCreateRequest; import org.junit.jupiter.api.Disabled; @@ -38,18 +35,6 @@ public class FunctionsDecompilationApiTest { private final FunctionsDecompilationApi api = new FunctionsDecompilationApi(); - /** - * Check the status of a function decompilation - * - * @throws ApiException if the Api call fails - */ - @Test - public void checkFunctionDecompilationTaskTest() throws ApiException { - Integer functionId = null; - BaseResponseFunctionTaskResponse response = api.checkFunctionDecompilationTask(functionId); - // TODO: test validations - } - /** * Create a comment for this function * @@ -65,18 +50,6 @@ public void createDecompilationCommentTest() throws ApiException { // TODO: test validations } - /** - * Queues a function decompilation - * - * @throws ApiException if the Api call fails - */ - @Test - public void createFunctionDecompilationTaskTest() throws ApiException { - Integer functionId = null; - BaseResponseStr response = api.createFunctionDecompilationTask(functionId); - // TODO: test validations - } - /** * Delete a comment * @@ -106,18 +79,6 @@ public void getDecompilationCommentsTest() throws ApiException { // TODO: test validations } - /** - * Get decompilation result - * - * @throws ApiException if the Api call fails - */ - @Test - public void getFunctionDecompilationTest() throws ApiException { - Integer functionId = null; - BaseResponseDecompilationResponse response = api.getFunctionDecompilation(functionId); - // TODO: test validations - } - /** * Update a comment * diff --git a/src/test/java/ai/reveng/model/BaseResponseDecompilationResponseTest.java b/src/test/java/ai/reveng/model/BaseResponseDecompilationResponseTest.java deleted file mode 100644 index 2e31f50..0000000 --- a/src/test/java/ai/reveng/model/BaseResponseDecompilationResponseTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.DecompilationResponse; -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 BaseResponseDecompilationResponse - */ -public class BaseResponseDecompilationResponseTest { - private final BaseResponseDecompilationResponse model = new BaseResponseDecompilationResponse(); - - /** - * Model tests for BaseResponseDecompilationResponse - */ - @Test - public void testBaseResponseDecompilationResponse() { - // TODO: test BaseResponseDecompilationResponse - } - - /** - * 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/DecompilationResponseTest.java b/src/test/java/ai/reveng/model/DecompilationResponseTest.java deleted file mode 100644 index 0337e4d..0000000 --- a/src/test/java/ai/reveng/model/DecompilationResponseTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 DecompilationResponse - */ -public class DecompilationResponseTest { - private final DecompilationResponse model = new DecompilationResponse(); - - /** - * Model tests for DecompilationResponse - */ - @Test - public void testDecompilationResponse() { - // TODO: test DecompilationResponse - } - - /** - * Test the property 'functionId' - */ - @Test - public void functionIdTest() { - // TODO: test functionId - } - - /** - * Test the property 'decompilation' - */ - @Test - public void decompilationTest() { - // TODO: test decompilation - } - - /** - * Test the property 'callingConvention' - */ - @Test - public void callingConventionTest() { - // TODO: test callingConvention - } - -}