diff --git a/.sdk-version b/.sdk-version index 32f8572..b0ab92d 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.8.1 +v3.12.0 diff --git a/README.md b/README.md index fb17fdd..dc0cdbc 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.8.1 + 3.12.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.8.1" + implementation "ai.reveng:sdk:3.12.0" } ``` @@ -87,6 +87,7 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**getAnalysisLogs**](docs/AnalysesCoreApi.md#getAnalysisLogs) | **GET** /v2/analyses/{analysis_id}/logs | Gets the logs of an analysis *AnalysesCoreApi* | [**getAnalysisParams**](docs/AnalysesCoreApi.md#getAnalysisParams) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information *AnalysesCoreApi* | [**getAnalysisStatus**](docs/AnalysesCoreApi.md#getAnalysisStatus) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis +*AnalysesCoreApi* | [**insertAnalysisLog**](docs/AnalysesCoreApi.md#insertAnalysisLog) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis *AnalysesCoreApi* | [**listAnalyses**](docs/AnalysesCoreApi.md#listAnalyses) | **GET** /v2/analyses/list | Gets the most recent analyses *AnalysesCoreApi* | [**lookupBinaryId**](docs/AnalysesCoreApi.md#lookupBinaryId) | **GET** /v2/analyses/lookup/{binary_id} | Gets the analysis ID from binary ID *AnalysesCoreApi* | [**requeueAnalysis**](docs/AnalysesCoreApi.md#requeueAnalysis) | **POST** /v2/analyses/{analysis_id}/requeue | Requeue Analysis @@ -399,6 +400,7 @@ Class | Method | HTTP request | Description - [ISA](docs/ISA.md) - [IconModel](docs/IconModel.md) - [ImportModel](docs/ImportModel.md) + - [InsertAnalysisLogRequest](docs/InsertAnalysisLogRequest.md) - [InverseFunctionMapItem](docs/InverseFunctionMapItem.md) - [InverseStringMapItem](docs/InverseStringMapItem.md) - [InverseValue](docs/InverseValue.md) diff --git a/build.gradle b/build.gradle index e17e075..5c9ef45 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.8.1' +version = '3.12.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.8.1") + coordinates("ai.reveng", "sdk", "3.12.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 07cb6d5..56bd9b2 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "3.8.1", + version := "3.12.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 71bea74..48b18b0 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -11,6 +11,7 @@ All URIs are relative to *https://api.reveng.ai* | [**getAnalysisLogs**](AnalysesCoreApi.md#getAnalysisLogs) | **GET** /v2/analyses/{analysis_id}/logs | Gets the logs of an analysis | | [**getAnalysisParams**](AnalysesCoreApi.md#getAnalysisParams) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information | | [**getAnalysisStatus**](AnalysesCoreApi.md#getAnalysisStatus) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis | +| [**insertAnalysisLog**](AnalysesCoreApi.md#insertAnalysisLog) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis | | [**listAnalyses**](AnalysesCoreApi.md#listAnalyses) | **GET** /v2/analyses/list | Gets the most recent analyses | | [**lookupBinaryId**](AnalysesCoreApi.md#lookupBinaryId) | **GET** /v2/analyses/lookup/{binary_id} | Gets the analysis ID from binary ID | | [**requeueAnalysis**](AnalysesCoreApi.md#requeueAnalysis) | **POST** /v2/analyses/{analysis_id}/requeue | Requeue Analysis | @@ -515,6 +516,78 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **insertAnalysisLog** +> BaseResponse insertAnalysisLog(analysisId, insertAnalysisLogRequest) + +Insert a log entry for an analysis + +Inserts a log record for an analysis. Only the analysis owner can insert logs. + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + Integer analysisId = 56; // Integer | + InsertAnalysisLogRequest insertAnalysisLogRequest = new InsertAnalysisLogRequest(); // InsertAnalysisLogRequest | + try { + BaseResponse result = apiInstance.insertAnalysisLog(analysisId, insertAnalysisLogRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#insertAnalysisLog"); + 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**| | | +| **insertAnalysisLogRequest** | [**InsertAnalysisLogRequest**](InsertAnalysisLogRequest.md)| | | + +### Return type + +[**BaseResponse**](BaseResponse.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Successful Response | - | +| **422** | Invalid request parameters | - | + # **listAnalyses** > BaseResponseRecent listAnalyses(searchTerm, workspace, status, modelName, dynamicExecutionStatus, usernames, sha256Hash, limit, offset, orderBy, order) diff --git a/docs/BaseResponse.md b/docs/BaseResponse.md index fbaa5f2..7572fbf 100644 --- a/docs/BaseResponse.md +++ b/docs/BaseResponse.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**AnyOf**](AnyOf.md) | Response data | [optional] | +|**data** | **Object** | | [optional] | |**message** | **String** | | [optional] | |**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | |**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | diff --git a/docs/Basic.md b/docs/Basic.md index dfda8d8..5b1951a 100644 --- a/docs/Basic.md +++ b/docs/Basic.md @@ -7,6 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**binaryId** | **Integer** | The ID of the binary | | |**binaryName** | **String** | The name of the binary uploaded | | |**binarySize** | **Integer** | The size of the binary uploaded (bytes) | | |**creation** | **OffsetDateTime** | When the binary was uploaded | | diff --git a/docs/InsertAnalysisLogRequest.md b/docs/InsertAnalysisLogRequest.md new file mode 100644 index 0000000..55c5473 --- /dev/null +++ b/docs/InsertAnalysisLogRequest.md @@ -0,0 +1,13 @@ + + +# InsertAnalysisLogRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**log** | **String** | The log message to insert for the analysis | | + + + diff --git a/docs/ModelName.md b/docs/ModelName.md index add775e..e2e9ee0 100644 --- a/docs/ModelName.md +++ b/docs/ModelName.md @@ -17,5 +17,11 @@ * `BINNET_0_7_ARM_64_LINUX` (value: `"binnet-0.7-arm-64-linux"`) +* `BINNET_0_7_X86_64_ANDROID` (value: `"binnet-0.7-x86-64-android"`) + +* `BINNET_0_7_X86_32_ANDROID` (value: `"binnet-0.7-x86-32-android"`) + +* `BINNET_0_7_ARM_64_ANDROID` (value: `"binnet-0.7-arm-64-android"`) + diff --git a/pom.xml b/pom.xml index 5377fec..f4606f2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.8.1 + 3.12.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesCoreApi.java b/src/main/java/ai/reveng/api/AnalysesCoreApi.java index 2a6422a..8a1206a 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -45,6 +45,7 @@ import ai.reveng.model.BaseResponseUploadResponse; import ai.reveng.model.DynamicExecutionStatusInput; import java.io.File; +import ai.reveng.model.InsertAnalysisLogRequest; import ai.reveng.model.ModelName; import ai.reveng.model.Order; import ai.reveng.model.ReAnalysisForm; @@ -1037,6 +1038,147 @@ public okhttp3.Call getAnalysisStatusAsync(@javax.annotation.Nonnull Integer ana localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for insertAnalysisLog + * @param analysisId (required) + * @param insertAnalysisLogRequest (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
201 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call insertAnalysisLogCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull InsertAnalysisLogRequest insertAnalysisLogRequest, 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 = insertAnalysisLogRequest; + + // create path and map variables + String localVarPath = "/v2/analyses/{analysis_id}/logs" + .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 = { + "application/json" + }; + 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 insertAnalysisLogValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull InsertAnalysisLogRequest insertAnalysisLogRequest, 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 insertAnalysisLog(Async)"); + } + + // verify the required parameter 'insertAnalysisLogRequest' is set + if (insertAnalysisLogRequest == null) { + throw new ApiException("Missing the required parameter 'insertAnalysisLogRequest' when calling insertAnalysisLog(Async)"); + } + + return insertAnalysisLogCall(analysisId, insertAnalysisLogRequest, _callback); + + } + + /** + * Insert a log entry for an analysis + * Inserts a log record for an analysis. Only the analysis owner can insert logs. + * @param analysisId (required) + * @param insertAnalysisLogRequest (required) + * @return BaseResponse + * @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
201 Successful Response -
422 Invalid request parameters -
+ */ + public BaseResponse insertAnalysisLog(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull InsertAnalysisLogRequest insertAnalysisLogRequest) throws ApiException { + ApiResponse localVarResp = insertAnalysisLogWithHttpInfo(analysisId, insertAnalysisLogRequest); + return localVarResp.getData(); + } + + /** + * Insert a log entry for an analysis + * Inserts a log record for an analysis. Only the analysis owner can insert logs. + * @param analysisId (required) + * @param insertAnalysisLogRequest (required) + * @return ApiResponse<BaseResponse> + * @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
201 Successful Response -
422 Invalid request parameters -
+ */ + public ApiResponse insertAnalysisLogWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull InsertAnalysisLogRequest insertAnalysisLogRequest) throws ApiException { + okhttp3.Call localVarCall = insertAnalysisLogValidateBeforeCall(analysisId, insertAnalysisLogRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Insert a log entry for an analysis (asynchronously) + * Inserts a log record for an analysis. Only the analysis owner can insert logs. + * @param analysisId (required) + * @param insertAnalysisLogRequest (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
201 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call insertAnalysisLogAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull InsertAnalysisLogRequest insertAnalysisLogRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = insertAnalysisLogValidateBeforeCall(analysisId, insertAnalysisLogRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for listAnalyses * @param searchTerm (optional, default to ) diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index accc3d4..49191a8 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -146,7 +146,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.8.1/java"); + setUserAgent("OpenAPI-Generator/3.12.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 890894c..d381237 100644 --- a/src/main/java/ai/reveng/invoker/Configuration.java +++ b/src/main/java/ai/reveng/invoker/Configuration.java @@ -18,7 +18,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "3.8.1"; + public static final String VERSION = "3.12.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 e00978a..85569c5 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -297,6 +297,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GlobalVariable.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IconModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ImportModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InsertAnalysisLogRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InverseFunctionMapItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InverseStringMapItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InverseValue.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/BaseResponse.java b/src/main/java/ai/reveng/model/BaseResponse.java index a56c27d..173c10e 100644 --- a/src/main/java/ai/reveng/model/BaseResponse.java +++ b/src/main/java/ai/reveng/model/BaseResponse.java @@ -14,7 +14,6 @@ import java.util.Objects; import java.util.Locale; -import ai.reveng.model.AnyOf; import ai.reveng.model.ErrorModel; import ai.reveng.model.MetaModel; import com.google.gson.TypeAdapter; @@ -65,7 +64,7 @@ public class BaseResponse { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) @javax.annotation.Nullable - private AnyOf data; + private Object data; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @@ -104,21 +103,21 @@ public void setStatus(@javax.annotation.Nullable Boolean status) { } - public BaseResponse data(@javax.annotation.Nullable AnyOf data) { + public BaseResponse data(@javax.annotation.Nullable Object data) { this.data = data; return this; } /** - * Response data + * Get data * @return data */ @javax.annotation.Nullable - public AnyOf getData() { + public Object getData() { return data; } - public void setData(@javax.annotation.Nullable AnyOf data) { + public void setData(@javax.annotation.Nullable Object data) { this.data = data; } @@ -316,10 +315,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - AnyOf.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())); } diff --git a/src/main/java/ai/reveng/model/Basic.java b/src/main/java/ai/reveng/model/Basic.java index 0591a2e..af89ebd 100644 --- a/src/main/java/ai/reveng/model/Basic.java +++ b/src/main/java/ai/reveng/model/Basic.java @@ -53,6 +53,11 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Basic { + public static final String SERIALIZED_NAME_BINARY_ID = "binary_id"; + @SerializedName(SERIALIZED_NAME_BINARY_ID) + @javax.annotation.Nonnull + private Integer binaryId; + public static final String SERIALIZED_NAME_BINARY_NAME = "binary_name"; @SerializedName(SERIALIZED_NAME_BINARY_NAME) @javax.annotation.Nonnull @@ -136,6 +141,25 @@ public class Basic { public Basic() { } + public Basic binaryId(@javax.annotation.Nonnull Integer binaryId) { + this.binaryId = binaryId; + return this; + } + + /** + * The ID of the binary + * @return binaryId + */ + @javax.annotation.Nonnull + public Integer getBinaryId() { + return binaryId; + } + + public void setBinaryId(@javax.annotation.Nonnull Integer binaryId) { + this.binaryId = binaryId; + } + + public Basic binaryName(@javax.annotation.Nonnull String binaryName) { this.binaryName = binaryName; return this; @@ -494,7 +518,8 @@ public boolean equals(Object o) { return false; } Basic basic = (Basic) o; - return Objects.equals(this.binaryName, basic.binaryName) && + return Objects.equals(this.binaryId, basic.binaryId) && + Objects.equals(this.binaryName, basic.binaryName) && Objects.equals(this.binarySize, basic.binarySize) && Objects.equals(this.creation, basic.creation) && Objects.equals(this.sha256Hash, basic.sha256Hash) && @@ -519,7 +544,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(binaryName, binarySize, creation, sha256Hash, modelName, modelId, ownerUsername, isSystem, analysisScope, isOwner, debug, functionCount, isAdvanced, baseAddress, binaryUuid, sequencerVersion, additionalProperties); + return Objects.hash(binaryId, binaryName, binarySize, creation, sha256Hash, modelName, modelId, ownerUsername, isSystem, analysisScope, isOwner, debug, functionCount, isAdvanced, baseAddress, binaryUuid, sequencerVersion, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -533,6 +558,7 @@ private static int hashCodeNullable(JsonNullable a) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Basic {\n"); + sb.append(" binaryId: ").append(toIndentedString(binaryId)).append("\n"); sb.append(" binaryName: ").append(toIndentedString(binaryName)).append("\n"); sb.append(" binarySize: ").append(toIndentedString(binarySize)).append("\n"); sb.append(" creation: ").append(toIndentedString(creation)).append("\n"); @@ -571,10 +597,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("binary_name", "binary_size", "creation", "sha_256_hash", "model_name", "model_id", "owner_username", "is_system", "analysis_scope", "is_owner", "debug", "function_count", "is_advanced", "base_address", "binary_uuid", "sequencer_version")); + openapiFields = new HashSet(Arrays.asList("binary_id", "binary_name", "binary_size", "creation", "sha_256_hash", "model_name", "model_id", "owner_username", "is_system", "analysis_scope", "is_owner", "debug", "function_count", "is_advanced", "base_address", "binary_uuid", "sequencer_version")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("binary_name", "binary_size", "creation", "sha_256_hash", "model_name", "model_id", "owner_username", "is_system", "analysis_scope", "is_owner", "debug", "function_count", "is_advanced", "base_address")); + openapiRequiredFields = new HashSet(Arrays.asList("binary_id", "binary_name", "binary_size", "creation", "sha_256_hash", "model_name", "model_id", "owner_username", "is_system", "analysis_scope", "is_owner", "debug", "function_count", "is_advanced", "base_address")); } /** diff --git a/src/main/java/ai/reveng/model/InsertAnalysisLogRequest.java b/src/main/java/ai/reveng/model/InsertAnalysisLogRequest.java new file mode 100644 index 0000000..19cc19e --- /dev/null +++ b/src/main/java/ai/reveng/model/InsertAnalysisLogRequest.java @@ -0,0 +1,294 @@ +/* + * 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; + +/** + * InsertAnalysisLogRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class InsertAnalysisLogRequest { + public static final String SERIALIZED_NAME_LOG = "log"; + @SerializedName(SERIALIZED_NAME_LOG) + @javax.annotation.Nonnull + private String log; + + public InsertAnalysisLogRequest() { + } + + public InsertAnalysisLogRequest log(@javax.annotation.Nonnull String log) { + this.log = log; + return this; + } + + /** + * The log message to insert for the analysis + * @return log + */ + @javax.annotation.Nonnull + public String getLog() { + return log; + } + + public void setLog(@javax.annotation.Nonnull String log) { + this.log = log; + } + + /** + * 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 InsertAnalysisLogRequest instance itself + */ + public InsertAnalysisLogRequest 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; + } + InsertAnalysisLogRequest insertAnalysisLogRequest = (InsertAnalysisLogRequest) o; + return Objects.equals(this.log, insertAnalysisLogRequest.log)&& + Objects.equals(this.additionalProperties, insertAnalysisLogRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(log, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InsertAnalysisLogRequest {\n"); + sb.append(" log: ").append(toIndentedString(log)).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("log")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("log")); + } + + /** + * 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 InsertAnalysisLogRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InsertAnalysisLogRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in InsertAnalysisLogRequest is not found in the empty JSON string", InsertAnalysisLogRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InsertAnalysisLogRequest.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("log").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `log` to be a primitive type in the JSON string but got `%s`", jsonObj.get("log").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InsertAnalysisLogRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InsertAnalysisLogRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InsertAnalysisLogRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InsertAnalysisLogRequest 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 InsertAnalysisLogRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InsertAnalysisLogRequest 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 InsertAnalysisLogRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of InsertAnalysisLogRequest + * @throws IOException if the JSON string is invalid with respect to InsertAnalysisLogRequest + */ + public static InsertAnalysisLogRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InsertAnalysisLogRequest.class); + } + + /** + * Convert an instance of InsertAnalysisLogRequest 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 9d9c997..de53157 100644 --- a/src/main/java/ai/reveng/model/ModelName.java +++ b/src/main/java/ai/reveng/model/ModelName.java @@ -40,7 +40,13 @@ public enum ModelName { BINNET_0_7_ARM_64_WINDOWS("binnet-0.7-arm-64-windows"), - BINNET_0_7_ARM_64_LINUX("binnet-0.7-arm-64-linux"); + BINNET_0_7_ARM_64_LINUX("binnet-0.7-arm-64-linux"), + + BINNET_0_7_X86_64_ANDROID("binnet-0.7-x86-64-android"), + + BINNET_0_7_X86_32_ANDROID("binnet-0.7-x86-32-android"), + + BINNET_0_7_ARM_64_ANDROID("binnet-0.7-arm-64-android"); private String value; diff --git a/src/test/java/ai/reveng/api/AnalysesCoreApiTest.java b/src/test/java/ai/reveng/api/AnalysesCoreApiTest.java index 0b9723d..8d44527 100644 --- a/src/test/java/ai/reveng/api/AnalysesCoreApiTest.java +++ b/src/test/java/ai/reveng/api/AnalysesCoreApiTest.java @@ -32,6 +32,7 @@ import ai.reveng.model.BaseResponseUploadResponse; import ai.reveng.model.DynamicExecutionStatusInput; import java.io.File; +import ai.reveng.model.InsertAnalysisLogRequest; import ai.reveng.model.ModelName; import ai.reveng.model.Order; import ai.reveng.model.ReAnalysisForm; @@ -153,6 +154,21 @@ public void getAnalysisStatusTest() throws ApiException { // TODO: test validations } + /** + * Insert a log entry for an analysis + * + * Inserts a log record for an analysis. Only the analysis owner can insert logs. + * + * @throws ApiException if the Api call fails + */ + @Test + public void insertAnalysisLogTest() throws ApiException { + Integer analysisId = null; + InsertAnalysisLogRequest insertAnalysisLogRequest = null; + BaseResponse response = api.insertAnalysisLog(analysisId, insertAnalysisLogRequest); + // TODO: test validations + } + /** * Gets the most recent analyses * diff --git a/src/test/java/ai/reveng/model/BaseResponseTest.java b/src/test/java/ai/reveng/model/BaseResponseTest.java index 3aa6ae1..f5bb20d 100644 --- a/src/test/java/ai/reveng/model/BaseResponseTest.java +++ b/src/test/java/ai/reveng/model/BaseResponseTest.java @@ -12,7 +12,6 @@ package ai.reveng.model; -import ai.reveng.model.AnyOf; import ai.reveng.model.ErrorModel; import ai.reveng.model.MetaModel; import com.google.gson.TypeAdapter; diff --git a/src/test/java/ai/reveng/model/BasicTest.java b/src/test/java/ai/reveng/model/BasicTest.java index 2e88a55..a8d6755 100644 --- a/src/test/java/ai/reveng/model/BasicTest.java +++ b/src/test/java/ai/reveng/model/BasicTest.java @@ -38,6 +38,14 @@ public void testBasic() { // TODO: test Basic } + /** + * Test the property 'binaryId' + */ + @Test + public void binaryIdTest() { + // TODO: test binaryId + } + /** * Test the property 'binaryName' */ diff --git a/src/test/java/ai/reveng/model/InsertAnalysisLogRequestTest.java b/src/test/java/ai/reveng/model/InsertAnalysisLogRequestTest.java new file mode 100644 index 0000000..3c689f0 --- /dev/null +++ b/src/test/java/ai/reveng/model/InsertAnalysisLogRequestTest.java @@ -0,0 +1,47 @@ +/* + * 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 InsertAnalysisLogRequest + */ +public class InsertAnalysisLogRequestTest { + private final InsertAnalysisLogRequest model = new InsertAnalysisLogRequest(); + + /** + * Model tests for InsertAnalysisLogRequest + */ + @Test + public void testInsertAnalysisLogRequest() { + // TODO: test InsertAnalysisLogRequest + } + + /** + * Test the property 'log' + */ + @Test + public void logTest() { + // TODO: test log + } + +}