From b5cdd03eb997fae55b88b229a2450448d60a260a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Oct 2025 17:23:10 +0000 Subject: [PATCH] Update SDK to version v2.11.7 - Generated from OpenAPI spec version v2.11.7 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 11 +- build.gradle | 4 +- build.sbt | 2 +- ...eResponseListTagOriginBoxPlotConfidence.md | 17 + docs/BoxPlotConfidence.md | 20 + docs/ConfidenceApi.md | 81 ++++ docs/FunctionDataTypesParams.md | 2 +- docs/FunctionMatchingFilters.md | 2 +- docs/FunctionMatchingRequest.md | 2 +- docs/Origin.md | 25 + docs/TagConfidenceBody.md | 13 + docs/TagOriginBoxPlotConfidence.md | 14 + docs/Tags.md | 14 + pom.xml | 2 +- .../java/ai/reveng/api/ConfidenceApi.java | 217 +++++++++ .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 5 + ...esponseListTagOriginBoxPlotConfidence.java | 456 ++++++++++++++++++ .../ai/reveng/model/BoxPlotConfidence.java | 448 +++++++++++++++++ .../reveng/model/FunctionDataTypesParams.java | 10 +- .../reveng/model/FunctionMatchingFilters.java | 10 +- .../reveng/model/FunctionMatchingRequest.java | 10 +- src/main/java/ai/reveng/model/Origin.java | 91 ++++ .../ai/reveng/model/TagConfidenceBody.java | 312 ++++++++++++ .../model/TagOriginBoxPlotConfidence.java | 323 +++++++++++++ src/main/java/ai/reveng/model/Tags.java | 323 +++++++++++++ .../java/ai/reveng/api/ConfidenceApiTest.java | 50 ++ ...nseListTagOriginBoxPlotConfidenceTest.java | 85 ++++ .../reveng/model/BoxPlotConfidenceTest.java | 96 ++++ src/test/java/ai/reveng/model/OriginTest.java | 31 ++ .../reveng/model/TagConfidenceBodyTest.java | 50 ++ .../model/TagOriginBoxPlotConfidenceTest.java | 57 +++ src/test/java/ai/reveng/model/TagsTest.java | 56 +++ 35 files changed, 2818 insertions(+), 27 deletions(-) create mode 100644 docs/BaseResponseListTagOriginBoxPlotConfidence.md create mode 100644 docs/BoxPlotConfidence.md create mode 100644 docs/ConfidenceApi.md create mode 100644 docs/Origin.md create mode 100644 docs/TagConfidenceBody.md create mode 100644 docs/TagOriginBoxPlotConfidence.md create mode 100644 docs/Tags.md create mode 100644 src/main/java/ai/reveng/api/ConfidenceApi.java create mode 100644 src/main/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidence.java create mode 100644 src/main/java/ai/reveng/model/BoxPlotConfidence.java create mode 100644 src/main/java/ai/reveng/model/Origin.java create mode 100644 src/main/java/ai/reveng/model/TagConfidenceBody.java create mode 100644 src/main/java/ai/reveng/model/TagOriginBoxPlotConfidence.java create mode 100644 src/main/java/ai/reveng/model/Tags.java create mode 100644 src/test/java/ai/reveng/api/ConfidenceApiTest.java create mode 100644 src/test/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidenceTest.java create mode 100644 src/test/java/ai/reveng/model/BoxPlotConfidenceTest.java create mode 100644 src/test/java/ai/reveng/model/OriginTest.java create mode 100644 src/test/java/ai/reveng/model/TagConfidenceBodyTest.java create mode 100644 src/test/java/ai/reveng/model/TagOriginBoxPlotConfidenceTest.java create mode 100644 src/test/java/ai/reveng/model/TagsTest.java diff --git a/.sdk-version b/.sdk-version index d6509f0..cee6f27 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v2.11.1 +v2.11.7 diff --git a/README.md b/README.md index 62d2c0e..a205820 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 2.11.1 + 2.11.7 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:2.11.1" + implementation "ai.reveng:sdk:2.11.7" } ``` @@ -129,6 +129,7 @@ Class | Method | HTTP request | Description *CollectionsApi* | [**updateCollection**](docs/CollectionsApi.md#updateCollection) | **PATCH** /v2/collections/{collection_id} | Updates a collection *CollectionsApi* | [**updateCollectionBinaries**](docs/CollectionsApi.md#updateCollectionBinaries) | **PATCH** /v2/collections/{collection_id}/binaries | Updates a collection binaries *CollectionsApi* | [**updateCollectionTags**](docs/CollectionsApi.md#updateCollectionTags) | **PATCH** /v2/collections/{collection_id}/tags | Updates a collection tags +*ConfidenceApi* | [**getAnalysisTagScore**](docs/ConfidenceApi.md#getAnalysisTagScore) | **POST** /v2/confidence/analysis/{analysis_id}/tag_score | Calculate Tag Confidence Score for an Analysis *ExternalSourcesApi* | [**createExternalTaskMb**](docs/ExternalSourcesApi.md#createExternalTaskMb) | **POST** /v2/analysis/{analysis_id}/external/mb | Pulls data from VirusTotal *ExternalSourcesApi* | [**createExternalTaskVt**](docs/ExternalSourcesApi.md#createExternalTaskVt) | **POST** /v2/analysis/{analysis_id}/external/vt | Pulls data from VirusTotal *ExternalSourcesApi* | [**getMbData**](docs/ExternalSourcesApi.md#getMbData) | **GET** /v2/analysis/{analysis_id}/external/mb | Get MalwareBazaar data @@ -267,6 +268,7 @@ Class | Method | HTTP request | Description - [BaseResponseListDieMatch](docs/BaseResponseListDieMatch.md) - [BaseResponseListFunctionNameHistory](docs/BaseResponseListFunctionNameHistory.md) - [BaseResponseListSBOM](docs/BaseResponseListSBOM.md) + - [BaseResponseListTagOriginBoxPlotConfidence](docs/BaseResponseListTagOriginBoxPlotConfidence.md) - [BaseResponseListUserActivityResponse](docs/BaseResponseListUserActivityResponse.md) - [BaseResponseLoginResponse](docs/BaseResponseLoginResponse.md) - [BaseResponseLogs](docs/BaseResponseLogs.md) @@ -299,6 +301,7 @@ Class | Method | HTTP request | Description - [BinaryTaskStatus](docs/BinaryTaskStatus.md) - [Block](docs/Block.md) - [BlockCommentsGenerationForFunctionResponse](docs/BlockCommentsGenerationForFunctionResponse.md) + - [BoxPlotConfidence](docs/BoxPlotConfidence.md) - [CalleeFunctionInfo](docs/CalleeFunctionInfo.md) - [CalleesCallerFunctionsResponse](docs/CalleesCallerFunctionsResponse.md) - [CallerFunctionInfo](docs/CallerFunctionInfo.md) @@ -414,6 +417,7 @@ Class | Method | HTTP request | Description - [NetworkOverviewMetadata](docs/NetworkOverviewMetadata.md) - [NetworkOverviewResponse](docs/NetworkOverviewResponse.md) - [Order](docs/Order.md) + - [Origin](docs/Origin.md) - [PDBDebugModel](docs/PDBDebugModel.md) - [PEModel](docs/PEModel.md) - [PaginationModel](docs/PaginationModel.md) @@ -457,9 +461,12 @@ Class | Method | HTTP request | Description - [TTPSElement](docs/TTPSElement.md) - [TTPSOccurance](docs/TTPSOccurance.md) - [Tag](docs/Tag.md) + - [TagConfidenceBody](docs/TagConfidenceBody.md) + - [TagOriginBoxPlotConfidence](docs/TagOriginBoxPlotConfidence.md) - [TagResponse](docs/TagResponse.md) - [TagSearchResponse](docs/TagSearchResponse.md) - [TagSearchResult](docs/TagSearchResult.md) + - [Tags](docs/Tags.md) - [TaskResponse](docs/TaskResponse.md) - [TaskStatus](docs/TaskStatus.md) - [TimestampModel](docs/TimestampModel.md) diff --git a/build.gradle b/build.gradle index 66a7e0f..1279e7c 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '2.11.1' +version = '2.11.7' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "2.11.1") + coordinates("ai.reveng", "sdk", "2.11.7") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index c23221b..cd57d06 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.11.1", + version := "2.11.7", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/BaseResponseListTagOriginBoxPlotConfidence.md b/docs/BaseResponseListTagOriginBoxPlotConfidence.md new file mode 100644 index 0000000..8a07667 --- /dev/null +++ b/docs/BaseResponseListTagOriginBoxPlotConfidence.md @@ -0,0 +1,17 @@ + + +# BaseResponseListTagOriginBoxPlotConfidence + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | +|**data** | [**List<TagOriginBoxPlotConfidence>**](TagOriginBoxPlotConfidence.md) | | [optional] | +|**message** | **String** | | [optional] | +|**errors** | [**List<ErrorModel>**](ErrorModel.md) | | [optional] | +|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | + + + diff --git a/docs/BoxPlotConfidence.md b/docs/BoxPlotConfidence.md new file mode 100644 index 0000000..dc98ad7 --- /dev/null +++ b/docs/BoxPlotConfidence.md @@ -0,0 +1,20 @@ + + +# BoxPlotConfidence + +Format for confidence - returned in the box plot format + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**min** | **BigDecimal** | | | +|**max** | **BigDecimal** | | | +|**average** | **BigDecimal** | | | +|**upperQuartile** | **BigDecimal** | | | +|**lowerQuartile** | **BigDecimal** | | | +|**positiveCount** | **Integer** | | | +|**negativeCount** | **Integer** | | | + + + diff --git a/docs/ConfidenceApi.md b/docs/ConfidenceApi.md new file mode 100644 index 0000000..c0ece78 --- /dev/null +++ b/docs/ConfidenceApi.md @@ -0,0 +1,81 @@ +# ConfidenceApi + +All URIs are relative to *https://api.reveng.ai* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getAnalysisTagScore**](ConfidenceApi.md#getAnalysisTagScore) | **POST** /v2/confidence/analysis/{analysis_id}/tag_score | Calculate Tag Confidence Score for an Analysis | + + + +# **getAnalysisTagScore** +> BaseResponseListTagOriginBoxPlotConfidence getAnalysisTagScore(analysisId, tagConfidenceBody) + +Calculate Tag Confidence Score for an Analysis + +Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + +### 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.ConfidenceApi; + +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"); + + ConfidenceApi apiInstance = new ConfidenceApi(defaultClient); + Integer analysisId = 56; // Integer | The analysis to calculate the tag scores for + TagConfidenceBody tagConfidenceBody = new TagConfidenceBody(); // TagConfidenceBody | + try { + BaseResponseListTagOriginBoxPlotConfidence result = apiInstance.getAnalysisTagScore(analysisId, tagConfidenceBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConfidenceApi#getAnalysisTagScore"); + 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**| The analysis to calculate the tag scores for | | +| **tagConfidenceBody** | [**TagConfidenceBody**](TagConfidenceBody.md)| | | + +### Return type + +[**BaseResponseListTagOriginBoxPlotConfidence**](BaseResponseListTagOriginBoxPlotConfidence.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful Response | - | +| **422** | Invalid request parameters | - | + diff --git a/docs/FunctionDataTypesParams.md b/docs/FunctionDataTypesParams.md index 5b347cf..7a362d1 100644 --- a/docs/FunctionDataTypesParams.md +++ b/docs/FunctionDataTypesParams.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**functionIds** | **List<Integer>** | The function ID's to generate/get data types for | | +|**functionIds** | **List<Long>** | The function ID's to generate/get data types for | | diff --git a/docs/FunctionMatchingFilters.md b/docs/FunctionMatchingFilters.md index b2bbf56..91466f5 100644 --- a/docs/FunctionMatchingFilters.md +++ b/docs/FunctionMatchingFilters.md @@ -9,7 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**binaryIds** | **List<Integer>** | ID's of binaries to limit the search to, if empty, search all scoped binaries | [optional] | |**collectionIds** | **List<Integer>** | ID's of collections to limit the search to, if empty, search all scoped collections | [optional] | -|**functionIds** | **List<Integer>** | ID's of functions to limit the search to, if empty, search all scoped functions | [optional] | +|**functionIds** | **List<Long>** | ID's of functions to limit the search to, if empty, search all scoped functions | [optional] | |**debugTypes** | [**List<DebugTypesEnum>**](#List<DebugTypesEnum>) | Limit the search to specific debug types, if empty, search all scoped debug & non-debug functions | [optional] | diff --git a/docs/FunctionMatchingRequest.md b/docs/FunctionMatchingRequest.md index c65a498..b6edc3c 100644 --- a/docs/FunctionMatchingRequest.md +++ b/docs/FunctionMatchingRequest.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**modelId** | **Integer** | ID of the model used for function matching, used to determine the embedding model | | -|**functionIds** | **List<Integer>** | ID's of functions to find matches for, must be at least one function ID | | +|**functionIds** | **List<Long>** | ID's of functions to find matches for, must be at least one function ID | | |**minSimilarity** | **BigDecimal** | Minimum similarity expected for a match as a percentage, default is 90 | [optional] | |**filters** | [**FunctionMatchingFilters**](FunctionMatchingFilters.md) | | [optional] | |**resultsPerFunction** | **Integer** | Maximum number of matches to return per function, default is 1, max is 50 | [optional] | diff --git a/docs/Origin.md b/docs/Origin.md new file mode 100644 index 0000000..41c47ae --- /dev/null +++ b/docs/Origin.md @@ -0,0 +1,25 @@ + + +# Origin + +## Enum + + +* `REV_ENG_MALWARE` (value: `"RevEng-Malware"`) + +* `REV_ENG_LIBRARY` (value: `"RevEng-Library"`) + +* `REV_ENG_BENIGN` (value: `"RevEng-Benign"`) + +* `REV_ENG` (value: `"RevEng"`) + +* `REV_ENG_HEURISTIC` (value: `"RevEng-Heuristic"`) + +* `REV_ENG_UNKNOWN` (value: `"RevEng-Unknown"`) + +* `VIRUS_TOTAL` (value: `"VirusTotal"`) + +* `MALWARE_BAZAAR` (value: `"MalwareBazaar"`) + + + diff --git a/docs/TagConfidenceBody.md b/docs/TagConfidenceBody.md new file mode 100644 index 0000000..d686c1e --- /dev/null +++ b/docs/TagConfidenceBody.md @@ -0,0 +1,13 @@ + + +# TagConfidenceBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tags** | [**List<Tags>**](Tags.md) | | | + + + diff --git a/docs/TagOriginBoxPlotConfidence.md b/docs/TagOriginBoxPlotConfidence.md new file mode 100644 index 0000000..46932bd --- /dev/null +++ b/docs/TagOriginBoxPlotConfidence.md @@ -0,0 +1,14 @@ + + +# TagOriginBoxPlotConfidence + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tag** | [**Tags**](Tags.md) | | | +|**boxPlot** | [**BoxPlotConfidence**](BoxPlotConfidence.md) | | | + + + diff --git a/docs/Tags.md b/docs/Tags.md new file mode 100644 index 0000000..7a4510d --- /dev/null +++ b/docs/Tags.md @@ -0,0 +1,14 @@ + + +# Tags + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tag** | **String** | The tag name | | +|**origin** | **Origin** | The origin of the tag | | + + + diff --git a/pom.xml b/pom.xml index a518ff5..b5b36d1 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 2.11.1 + 2.11.7 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/ConfidenceApi.java b/src/main/java/ai/reveng/api/ConfidenceApi.java new file mode 100644 index 0000000..a914c04 --- /dev/null +++ b/src/main/java/ai/reveng/api/ConfidenceApi.java @@ -0,0 +1,217 @@ +/* + * 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.api; + +import ai.reveng.invoker.ApiCallback; +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.ApiResponse; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.Pair; +import ai.reveng.invoker.ProgressRequestBody; +import ai.reveng.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import ai.reveng.model.BaseResponse; +import ai.reveng.model.BaseResponseListTagOriginBoxPlotConfidence; +import ai.reveng.model.TagConfidenceBody; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ConfidenceApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ConfidenceApi() { + this(Configuration.getDefaultApiClient()); + } + + public ConfidenceApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getAnalysisTagScore + * @param analysisId The analysis to calculate the tag scores for (required) + * @param tagConfidenceBody (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 getAnalysisTagScoreCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull TagConfidenceBody tagConfidenceBody, 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 = tagConfidenceBody; + + // create path and map variables + String localVarPath = "/v2/confidence/analysis/{analysis_id}/tag_score" + .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 getAnalysisTagScoreValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull TagConfidenceBody tagConfidenceBody, 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 getAnalysisTagScore(Async)"); + } + + // verify the required parameter 'tagConfidenceBody' is set + if (tagConfidenceBody == null) { + throw new ApiException("Missing the required parameter 'tagConfidenceBody' when calling getAnalysisTagScore(Async)"); + } + + return getAnalysisTagScoreCall(analysisId, tagConfidenceBody, _callback); + + } + + /** + * Calculate Tag Confidence Score for an Analysis + * Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + * @param analysisId The analysis to calculate the tag scores for (required) + * @param tagConfidenceBody (required) + * @return BaseResponseListTagOriginBoxPlotConfidence + * @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 BaseResponseListTagOriginBoxPlotConfidence getAnalysisTagScore(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull TagConfidenceBody tagConfidenceBody) throws ApiException { + ApiResponse localVarResp = getAnalysisTagScoreWithHttpInfo(analysisId, tagConfidenceBody); + return localVarResp.getData(); + } + + /** + * Calculate Tag Confidence Score for an Analysis + * Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + * @param analysisId The analysis to calculate the tag scores for (required) + * @param tagConfidenceBody (required) + * @return ApiResponse<BaseResponseListTagOriginBoxPlotConfidence> + * @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 getAnalysisTagScoreWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull TagConfidenceBody tagConfidenceBody) throws ApiException { + okhttp3.Call localVarCall = getAnalysisTagScoreValidateBeforeCall(analysisId, tagConfidenceBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Calculate Tag Confidence Score for an Analysis (asynchronously) + * Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + * @param analysisId The analysis to calculate the tag scores for (required) + * @param tagConfidenceBody (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 getAnalysisTagScoreAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull TagConfidenceBody tagConfidenceBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAnalysisTagScoreValidateBeforeCall(analysisId, tagConfidenceBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index f0103dc..06aa188 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.11.1/java"); + setUserAgent("OpenAPI-Generator/2.11.7/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 34b97e6..5fdaa6d 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.11.1"; + public static final String VERSION = "2.11.7"; 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 372cdae..469a87f 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -173,6 +173,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListDieMatch.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListFunctionNameHistory.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListSBOM.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListTagOriginBoxPlotConfidence.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListUserActivityResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseLoginResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseLogs.CustomTypeAdapterFactory()); @@ -204,6 +205,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinarySearchResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Block.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BlockCommentsGenerationForFunctionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BoxPlotConfidence.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CalleeFunctionInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CalleesCallerFunctionsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CallerFunctionInfo.CustomTypeAdapterFactory()); @@ -350,9 +352,12 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TTPSElement.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TTPSOccurance.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Tag.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagConfidenceBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagOriginBoxPlotConfidence.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagSearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagSearchResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Tags.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TaskResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TimestampModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypeDefinition.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidence.java b/src/main/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidence.java new file mode 100644 index 0000000..7667f01 --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidence.java @@ -0,0 +1,456 @@ +/* + * 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.ErrorModel; +import ai.reveng.model.MetaModel; +import ai.reveng.model.TagOriginBoxPlotConfidence; +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; + +/** + * BaseResponseListTagOriginBoxPlotConfidence + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseResponseListTagOriginBoxPlotConfidence { + 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 List 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 BaseResponseListTagOriginBoxPlotConfidence() { + } + + public BaseResponseListTagOriginBoxPlotConfidence 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 BaseResponseListTagOriginBoxPlotConfidence data(@javax.annotation.Nullable List data) { + this.data = data; + return this; + } + + public BaseResponseListTagOriginBoxPlotConfidence addDataItem(TagOriginBoxPlotConfidence dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public List getData() { + return data; + } + + public void setData(@javax.annotation.Nullable List data) { + this.data = data; + } + + + public BaseResponseListTagOriginBoxPlotConfidence 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 BaseResponseListTagOriginBoxPlotConfidence errors(@javax.annotation.Nullable List errors) { + this.errors = errors; + return this; + } + + public BaseResponseListTagOriginBoxPlotConfidence 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 BaseResponseListTagOriginBoxPlotConfidence 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 BaseResponseListTagOriginBoxPlotConfidence instance itself + */ + public BaseResponseListTagOriginBoxPlotConfidence 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; + } + BaseResponseListTagOriginBoxPlotConfidence baseResponseListTagOriginBoxPlotConfidence = (BaseResponseListTagOriginBoxPlotConfidence) o; + return Objects.equals(this.status, baseResponseListTagOriginBoxPlotConfidence.status) && + Objects.equals(this.data, baseResponseListTagOriginBoxPlotConfidence.data) && + Objects.equals(this.message, baseResponseListTagOriginBoxPlotConfidence.message) && + Objects.equals(this.errors, baseResponseListTagOriginBoxPlotConfidence.errors) && + Objects.equals(this.meta, baseResponseListTagOriginBoxPlotConfidence.meta)&& + Objects.equals(this.additionalProperties, baseResponseListTagOriginBoxPlotConfidence.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 BaseResponseListTagOriginBoxPlotConfidence {\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 BaseResponseListTagOriginBoxPlotConfidence + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseResponseListTagOriginBoxPlotConfidence.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BaseResponseListTagOriginBoxPlotConfidence is not found in the empty JSON string", BaseResponseListTagOriginBoxPlotConfidence.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + TagOriginBoxPlotConfidence.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + 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 (!BaseResponseListTagOriginBoxPlotConfidence.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseResponseListTagOriginBoxPlotConfidence' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseListTagOriginBoxPlotConfidence.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseResponseListTagOriginBoxPlotConfidence 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 BaseResponseListTagOriginBoxPlotConfidence read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BaseResponseListTagOriginBoxPlotConfidence 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 BaseResponseListTagOriginBoxPlotConfidence given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseResponseListTagOriginBoxPlotConfidence + * @throws IOException if the JSON string is invalid with respect to BaseResponseListTagOriginBoxPlotConfidence + */ + public static BaseResponseListTagOriginBoxPlotConfidence fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseResponseListTagOriginBoxPlotConfidence.class); + } + + /** + * Convert an instance of BaseResponseListTagOriginBoxPlotConfidence to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BoxPlotConfidence.java b/src/main/java/ai/reveng/model/BoxPlotConfidence.java new file mode 100644 index 0000000..6dc3e5f --- /dev/null +++ b/src/main/java/ai/reveng/model/BoxPlotConfidence.java @@ -0,0 +1,448 @@ +/* + * 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.math.BigDecimal; +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; + +/** + * Format for confidence - returned in the box plot format + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BoxPlotConfidence { + public static final String SERIALIZED_NAME_MIN = "min"; + @SerializedName(SERIALIZED_NAME_MIN) + @javax.annotation.Nonnull + private BigDecimal min; + + public static final String SERIALIZED_NAME_MAX = "max"; + @SerializedName(SERIALIZED_NAME_MAX) + @javax.annotation.Nonnull + private BigDecimal max; + + public static final String SERIALIZED_NAME_AVERAGE = "average"; + @SerializedName(SERIALIZED_NAME_AVERAGE) + @javax.annotation.Nonnull + private BigDecimal average; + + public static final String SERIALIZED_NAME_UPPER_QUARTILE = "upper_quartile"; + @SerializedName(SERIALIZED_NAME_UPPER_QUARTILE) + @javax.annotation.Nonnull + private BigDecimal upperQuartile; + + public static final String SERIALIZED_NAME_LOWER_QUARTILE = "lower_quartile"; + @SerializedName(SERIALIZED_NAME_LOWER_QUARTILE) + @javax.annotation.Nonnull + private BigDecimal lowerQuartile; + + public static final String SERIALIZED_NAME_POSITIVE_COUNT = "positive_count"; + @SerializedName(SERIALIZED_NAME_POSITIVE_COUNT) + @javax.annotation.Nonnull + private Integer positiveCount; + + public static final String SERIALIZED_NAME_NEGATIVE_COUNT = "negative_count"; + @SerializedName(SERIALIZED_NAME_NEGATIVE_COUNT) + @javax.annotation.Nonnull + private Integer negativeCount; + + public BoxPlotConfidence() { + } + + public BoxPlotConfidence min(@javax.annotation.Nonnull BigDecimal min) { + this.min = min; + return this; + } + + /** + * Get min + * @return min + */ + @javax.annotation.Nonnull + public BigDecimal getMin() { + return min; + } + + public void setMin(@javax.annotation.Nonnull BigDecimal min) { + this.min = min; + } + + + public BoxPlotConfidence max(@javax.annotation.Nonnull BigDecimal max) { + this.max = max; + return this; + } + + /** + * Get max + * @return max + */ + @javax.annotation.Nonnull + public BigDecimal getMax() { + return max; + } + + public void setMax(@javax.annotation.Nonnull BigDecimal max) { + this.max = max; + } + + + public BoxPlotConfidence average(@javax.annotation.Nonnull BigDecimal average) { + this.average = average; + return this; + } + + /** + * Get average + * @return average + */ + @javax.annotation.Nonnull + public BigDecimal getAverage() { + return average; + } + + public void setAverage(@javax.annotation.Nonnull BigDecimal average) { + this.average = average; + } + + + public BoxPlotConfidence upperQuartile(@javax.annotation.Nonnull BigDecimal upperQuartile) { + this.upperQuartile = upperQuartile; + return this; + } + + /** + * Get upperQuartile + * @return upperQuartile + */ + @javax.annotation.Nonnull + public BigDecimal getUpperQuartile() { + return upperQuartile; + } + + public void setUpperQuartile(@javax.annotation.Nonnull BigDecimal upperQuartile) { + this.upperQuartile = upperQuartile; + } + + + public BoxPlotConfidence lowerQuartile(@javax.annotation.Nonnull BigDecimal lowerQuartile) { + this.lowerQuartile = lowerQuartile; + return this; + } + + /** + * Get lowerQuartile + * @return lowerQuartile + */ + @javax.annotation.Nonnull + public BigDecimal getLowerQuartile() { + return lowerQuartile; + } + + public void setLowerQuartile(@javax.annotation.Nonnull BigDecimal lowerQuartile) { + this.lowerQuartile = lowerQuartile; + } + + + public BoxPlotConfidence positiveCount(@javax.annotation.Nonnull Integer positiveCount) { + this.positiveCount = positiveCount; + return this; + } + + /** + * Get positiveCount + * @return positiveCount + */ + @javax.annotation.Nonnull + public Integer getPositiveCount() { + return positiveCount; + } + + public void setPositiveCount(@javax.annotation.Nonnull Integer positiveCount) { + this.positiveCount = positiveCount; + } + + + public BoxPlotConfidence negativeCount(@javax.annotation.Nonnull Integer negativeCount) { + this.negativeCount = negativeCount; + return this; + } + + /** + * Get negativeCount + * @return negativeCount + */ + @javax.annotation.Nonnull + public Integer getNegativeCount() { + return negativeCount; + } + + public void setNegativeCount(@javax.annotation.Nonnull Integer negativeCount) { + this.negativeCount = negativeCount; + } + + /** + * 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 BoxPlotConfidence instance itself + */ + public BoxPlotConfidence 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; + } + BoxPlotConfidence boxPlotConfidence = (BoxPlotConfidence) o; + return Objects.equals(this.min, boxPlotConfidence.min) && + Objects.equals(this.max, boxPlotConfidence.max) && + Objects.equals(this.average, boxPlotConfidence.average) && + Objects.equals(this.upperQuartile, boxPlotConfidence.upperQuartile) && + Objects.equals(this.lowerQuartile, boxPlotConfidence.lowerQuartile) && + Objects.equals(this.positiveCount, boxPlotConfidence.positiveCount) && + Objects.equals(this.negativeCount, boxPlotConfidence.negativeCount)&& + Objects.equals(this.additionalProperties, boxPlotConfidence.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(min, max, average, upperQuartile, lowerQuartile, positiveCount, negativeCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BoxPlotConfidence {\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" average: ").append(toIndentedString(average)).append("\n"); + sb.append(" upperQuartile: ").append(toIndentedString(upperQuartile)).append("\n"); + sb.append(" lowerQuartile: ").append(toIndentedString(lowerQuartile)).append("\n"); + sb.append(" positiveCount: ").append(toIndentedString(positiveCount)).append("\n"); + sb.append(" negativeCount: ").append(toIndentedString(negativeCount)).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("min", "max", "average", "upper_quartile", "lower_quartile", "positive_count", "negative_count")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("min", "max", "average", "upper_quartile", "lower_quartile", "positive_count", "negative_count")); + } + + /** + * 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 BoxPlotConfidence + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BoxPlotConfidence.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in BoxPlotConfidence is not found in the empty JSON string", BoxPlotConfidence.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BoxPlotConfidence.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(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BoxPlotConfidence.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BoxPlotConfidence' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BoxPlotConfidence.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BoxPlotConfidence 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 BoxPlotConfidence read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BoxPlotConfidence 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 BoxPlotConfidence given an JSON string + * + * @param jsonString JSON string + * @return An instance of BoxPlotConfidence + * @throws IOException if the JSON string is invalid with respect to BoxPlotConfidence + */ + public static BoxPlotConfidence fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BoxPlotConfidence.class); + } + + /** + * Convert an instance of BoxPlotConfidence to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionDataTypesParams.java b/src/main/java/ai/reveng/model/FunctionDataTypesParams.java index ff46506..1f2fd1d 100644 --- a/src/main/java/ai/reveng/model/FunctionDataTypesParams.java +++ b/src/main/java/ai/reveng/model/FunctionDataTypesParams.java @@ -56,17 +56,17 @@ public class FunctionDataTypesParams { public static final String SERIALIZED_NAME_FUNCTION_IDS = "function_ids"; @SerializedName(SERIALIZED_NAME_FUNCTION_IDS) @javax.annotation.Nonnull - private List functionIds = new ArrayList<>(); + private List functionIds = new ArrayList<>(); public FunctionDataTypesParams() { } - public FunctionDataTypesParams functionIds(@javax.annotation.Nonnull List functionIds) { + public FunctionDataTypesParams functionIds(@javax.annotation.Nonnull List functionIds) { this.functionIds = functionIds; return this; } - public FunctionDataTypesParams addFunctionIdsItem(Integer functionIdsItem) { + public FunctionDataTypesParams addFunctionIdsItem(Long functionIdsItem) { if (this.functionIds == null) { this.functionIds = new ArrayList<>(); } @@ -79,11 +79,11 @@ public FunctionDataTypesParams addFunctionIdsItem(Integer functionIdsItem) { * @return functionIds */ @javax.annotation.Nonnull - public List getFunctionIds() { + public List getFunctionIds() { return functionIds; } - public void setFunctionIds(@javax.annotation.Nonnull List functionIds) { + public void setFunctionIds(@javax.annotation.Nonnull List functionIds) { this.functionIds = functionIds; } diff --git a/src/main/java/ai/reveng/model/FunctionMatchingFilters.java b/src/main/java/ai/reveng/model/FunctionMatchingFilters.java index acfff60..50bdbcc 100644 --- a/src/main/java/ai/reveng/model/FunctionMatchingFilters.java +++ b/src/main/java/ai/reveng/model/FunctionMatchingFilters.java @@ -66,7 +66,7 @@ public class FunctionMatchingFilters { public static final String SERIALIZED_NAME_FUNCTION_IDS = "function_ids"; @SerializedName(SERIALIZED_NAME_FUNCTION_IDS) @javax.annotation.Nullable - private List functionIds = new ArrayList<>(); + private List functionIds = new ArrayList<>(); /** * Gets or Sets debugTypes @@ -184,12 +184,12 @@ public void setCollectionIds(@javax.annotation.Nullable List collection } - public FunctionMatchingFilters functionIds(@javax.annotation.Nullable List functionIds) { + public FunctionMatchingFilters functionIds(@javax.annotation.Nullable List functionIds) { this.functionIds = functionIds; return this; } - public FunctionMatchingFilters addFunctionIdsItem(Integer functionIdsItem) { + public FunctionMatchingFilters addFunctionIdsItem(Long functionIdsItem) { if (this.functionIds == null) { this.functionIds = new ArrayList<>(); } @@ -202,11 +202,11 @@ public FunctionMatchingFilters addFunctionIdsItem(Integer functionIdsItem) { * @return functionIds */ @javax.annotation.Nullable - public List getFunctionIds() { + public List getFunctionIds() { return functionIds; } - public void setFunctionIds(@javax.annotation.Nullable List functionIds) { + public void setFunctionIds(@javax.annotation.Nullable List functionIds) { this.functionIds = functionIds; } diff --git a/src/main/java/ai/reveng/model/FunctionMatchingRequest.java b/src/main/java/ai/reveng/model/FunctionMatchingRequest.java index 9661793..54514c5 100644 --- a/src/main/java/ai/reveng/model/FunctionMatchingRequest.java +++ b/src/main/java/ai/reveng/model/FunctionMatchingRequest.java @@ -64,7 +64,7 @@ public class FunctionMatchingRequest { public static final String SERIALIZED_NAME_FUNCTION_IDS = "function_ids"; @SerializedName(SERIALIZED_NAME_FUNCTION_IDS) @javax.annotation.Nonnull - private List functionIds = new ArrayList<>(); + private List functionIds = new ArrayList<>(); public static final String SERIALIZED_NAME_MIN_SIMILARITY = "min_similarity"; @SerializedName(SERIALIZED_NAME_MIN_SIMILARITY) @@ -113,12 +113,12 @@ public void setModelId(@javax.annotation.Nonnull Integer modelId) { } - public FunctionMatchingRequest functionIds(@javax.annotation.Nonnull List functionIds) { + public FunctionMatchingRequest functionIds(@javax.annotation.Nonnull List functionIds) { this.functionIds = functionIds; return this; } - public FunctionMatchingRequest addFunctionIdsItem(Integer functionIdsItem) { + public FunctionMatchingRequest addFunctionIdsItem(Long functionIdsItem) { if (this.functionIds == null) { this.functionIds = new ArrayList<>(); } @@ -131,11 +131,11 @@ public FunctionMatchingRequest addFunctionIdsItem(Integer functionIdsItem) { * @return functionIds */ @javax.annotation.Nonnull - public List getFunctionIds() { + public List getFunctionIds() { return functionIds; } - public void setFunctionIds(@javax.annotation.Nonnull List functionIds) { + public void setFunctionIds(@javax.annotation.Nonnull List functionIds) { this.functionIds = functionIds; } diff --git a/src/main/java/ai/reveng/model/Origin.java b/src/main/java/ai/reveng/model/Origin.java new file mode 100644 index 0000000..3651ba7 --- /dev/null +++ b/src/main/java/ai/reveng/model/Origin.java @@ -0,0 +1,91 @@ +/* + * 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.annotations.SerializedName; + +import java.io.IOException; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Gets or Sets Origin + */ +@JsonAdapter(Origin.Adapter.class) +public enum Origin { + + REV_ENG_MALWARE("RevEng-Malware"), + + REV_ENG_LIBRARY("RevEng-Library"), + + REV_ENG_BENIGN("RevEng-Benign"), + + REV_ENG("RevEng"), + + REV_ENG_HEURISTIC("RevEng-Heuristic"), + + REV_ENG_UNKNOWN("RevEng-Unknown"), + + VIRUS_TOTAL("VirusTotal"), + + MALWARE_BAZAAR("MalwareBazaar"); + + private String value; + + Origin(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static Origin fromValue(String value) { + for (Origin b : Origin.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final Origin enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public Origin read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return Origin.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + Origin.fromValue(value); + } +} + diff --git a/src/main/java/ai/reveng/model/TagConfidenceBody.java b/src/main/java/ai/reveng/model/TagConfidenceBody.java new file mode 100644 index 0000000..2cf9d00 --- /dev/null +++ b/src/main/java/ai/reveng/model/TagConfidenceBody.java @@ -0,0 +1,312 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.Tags; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * TagConfidenceBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TagConfidenceBody { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nonnull + private List tags = new ArrayList<>(); + + public TagConfidenceBody() { + } + + public TagConfidenceBody tags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + return this; + } + + public TagConfidenceBody addTagsItem(Tags tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nonnull + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nonnull List tags) { + this.tags = tags; + } + + /** + * 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 TagConfidenceBody instance itself + */ + public TagConfidenceBody 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; + } + TagConfidenceBody tagConfidenceBody = (TagConfidenceBody) o; + return Objects.equals(this.tags, tagConfidenceBody.tags)&& + Objects.equals(this.additionalProperties, tagConfidenceBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagConfidenceBody {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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("tags")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("tags")); + } + + /** + * 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 TagConfidenceBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagConfidenceBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TagConfidenceBody is not found in the empty JSON string", TagConfidenceBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagConfidenceBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + // validate the required field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + Tags.validateJsonElement(jsonArraytags.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagConfidenceBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagConfidenceBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagConfidenceBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagConfidenceBody 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 TagConfidenceBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TagConfidenceBody 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 TagConfidenceBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagConfidenceBody + * @throws IOException if the JSON string is invalid with respect to TagConfidenceBody + */ + public static TagConfidenceBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagConfidenceBody.class); + } + + /** + * Convert an instance of TagConfidenceBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TagOriginBoxPlotConfidence.java b/src/main/java/ai/reveng/model/TagOriginBoxPlotConfidence.java new file mode 100644 index 0000000..24114d1 --- /dev/null +++ b/src/main/java/ai/reveng/model/TagOriginBoxPlotConfidence.java @@ -0,0 +1,323 @@ +/* + * 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.BoxPlotConfidence; +import ai.reveng.model.Tags; +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; + +/** + * TagOriginBoxPlotConfidence + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TagOriginBoxPlotConfidence { + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nonnull + private Tags tag; + + public static final String SERIALIZED_NAME_BOX_PLOT = "box_plot"; + @SerializedName(SERIALIZED_NAME_BOX_PLOT) + @javax.annotation.Nonnull + private BoxPlotConfidence boxPlot; + + public TagOriginBoxPlotConfidence() { + } + + public TagOriginBoxPlotConfidence tag(@javax.annotation.Nonnull Tags tag) { + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + */ + @javax.annotation.Nonnull + public Tags getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nonnull Tags tag) { + this.tag = tag; + } + + + public TagOriginBoxPlotConfidence boxPlot(@javax.annotation.Nonnull BoxPlotConfidence boxPlot) { + this.boxPlot = boxPlot; + return this; + } + + /** + * Get boxPlot + * @return boxPlot + */ + @javax.annotation.Nonnull + public BoxPlotConfidence getBoxPlot() { + return boxPlot; + } + + public void setBoxPlot(@javax.annotation.Nonnull BoxPlotConfidence boxPlot) { + this.boxPlot = boxPlot; + } + + /** + * 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 TagOriginBoxPlotConfidence instance itself + */ + public TagOriginBoxPlotConfidence 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; + } + TagOriginBoxPlotConfidence tagOriginBoxPlotConfidence = (TagOriginBoxPlotConfidence) o; + return Objects.equals(this.tag, tagOriginBoxPlotConfidence.tag) && + Objects.equals(this.boxPlot, tagOriginBoxPlotConfidence.boxPlot)&& + Objects.equals(this.additionalProperties, tagOriginBoxPlotConfidence.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tag, boxPlot, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagOriginBoxPlotConfidence {\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" boxPlot: ").append(toIndentedString(boxPlot)).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("tag", "box_plot")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("tag", "box_plot")); + } + + /** + * 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 TagOriginBoxPlotConfidence + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagOriginBoxPlotConfidence.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in TagOriginBoxPlotConfidence is not found in the empty JSON string", TagOriginBoxPlotConfidence.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagOriginBoxPlotConfidence.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `tag` + Tags.validateJsonElement(jsonObj.get("tag")); + // validate the required field `box_plot` + BoxPlotConfidence.validateJsonElement(jsonObj.get("box_plot")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagOriginBoxPlotConfidence.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagOriginBoxPlotConfidence' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagOriginBoxPlotConfidence.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagOriginBoxPlotConfidence 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 TagOriginBoxPlotConfidence read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TagOriginBoxPlotConfidence 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 TagOriginBoxPlotConfidence given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagOriginBoxPlotConfidence + * @throws IOException if the JSON string is invalid with respect to TagOriginBoxPlotConfidence + */ + public static TagOriginBoxPlotConfidence fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagOriginBoxPlotConfidence.class); + } + + /** + * Convert an instance of TagOriginBoxPlotConfidence to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Tags.java b/src/main/java/ai/reveng/model/Tags.java new file mode 100644 index 0000000..dcd21dc --- /dev/null +++ b/src/main/java/ai/reveng/model/Tags.java @@ -0,0 +1,323 @@ +/* + * 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.Origin; +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; + +/** + * Tags + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class Tags { + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nonnull + private String tag; + + public static final String SERIALIZED_NAME_ORIGIN = "origin"; + @SerializedName(SERIALIZED_NAME_ORIGIN) + @javax.annotation.Nonnull + private Origin origin; + + public Tags() { + } + + public Tags tag(@javax.annotation.Nonnull String tag) { + this.tag = tag; + return this; + } + + /** + * The tag name + * @return tag + */ + @javax.annotation.Nonnull + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nonnull String tag) { + this.tag = tag; + } + + + public Tags origin(@javax.annotation.Nonnull Origin origin) { + this.origin = origin; + return this; + } + + /** + * The origin of the tag + * @return origin + */ + @javax.annotation.Nonnull + public Origin getOrigin() { + return origin; + } + + public void setOrigin(@javax.annotation.Nonnull Origin origin) { + this.origin = origin; + } + + /** + * 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 Tags instance itself + */ + public Tags 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; + } + Tags tags = (Tags) o; + return Objects.equals(this.tag, tags.tag) && + Objects.equals(this.origin, tags.origin)&& + Objects.equals(this.additionalProperties, tags.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tag, origin, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tags {\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" origin: ").append(toIndentedString(origin)).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("tag", "origin")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("tag", "origin")); + } + + /** + * 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 Tags + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tags.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Tags is not found in the empty JSON string", Tags.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Tags.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("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // validate the required field `origin` + Origin.validateJsonElement(jsonObj.get("origin")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tags.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tags' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tags.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tags 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 Tags read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tags 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 Tags given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tags + * @throws IOException if the JSON string is invalid with respect to Tags + */ + public static Tags fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tags.class); + } + + /** + * Convert an instance of Tags to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/test/java/ai/reveng/api/ConfidenceApiTest.java b/src/test/java/ai/reveng/api/ConfidenceApiTest.java new file mode 100644 index 0000000..3c609ca --- /dev/null +++ b/src/test/java/ai/reveng/api/ConfidenceApiTest.java @@ -0,0 +1,50 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.api; + +import ai.reveng.invoker.ApiException; +import ai.reveng.model.BaseResponse; +import ai.reveng.model.BaseResponseListTagOriginBoxPlotConfidence; +import ai.reveng.model.TagConfidenceBody; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for ConfidenceApi + */ +@Disabled +public class ConfidenceApiTest { + + private final ConfidenceApi api = new ConfidenceApi(); + + /** + * Calculate Tag Confidence Score for an Analysis + * + * Accepts a analysis ID and a list of tags, returns the confidence score for each tag in the list + * + * @throws ApiException if the Api call fails + */ + @Test + public void getAnalysisTagScoreTest() throws ApiException { + Integer analysisId = null; + TagConfidenceBody tagConfidenceBody = null; + BaseResponseListTagOriginBoxPlotConfidence response = api.getAnalysisTagScore(analysisId, tagConfidenceBody); + // TODO: test validations + } + +} diff --git a/src/test/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidenceTest.java b/src/test/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidenceTest.java new file mode 100644 index 0000000..25ef548 --- /dev/null +++ b/src/test/java/ai/reveng/model/BaseResponseListTagOriginBoxPlotConfidenceTest.java @@ -0,0 +1,85 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import ai.reveng.model.ErrorModel; +import ai.reveng.model.MetaModel; +import ai.reveng.model.TagOriginBoxPlotConfidence; +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 BaseResponseListTagOriginBoxPlotConfidence + */ +public class BaseResponseListTagOriginBoxPlotConfidenceTest { + private final BaseResponseListTagOriginBoxPlotConfidence model = new BaseResponseListTagOriginBoxPlotConfidence(); + + /** + * Model tests for BaseResponseListTagOriginBoxPlotConfidence + */ + @Test + public void testBaseResponseListTagOriginBoxPlotConfidence() { + // TODO: test BaseResponseListTagOriginBoxPlotConfidence + } + + /** + * 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/BoxPlotConfidenceTest.java b/src/test/java/ai/reveng/model/BoxPlotConfidenceTest.java new file mode 100644 index 0000000..85524ce --- /dev/null +++ b/src/test/java/ai/reveng/model/BoxPlotConfidenceTest.java @@ -0,0 +1,96 @@ +/* + * 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.math.BigDecimal; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for BoxPlotConfidence + */ +public class BoxPlotConfidenceTest { + private final BoxPlotConfidence model = new BoxPlotConfidence(); + + /** + * Model tests for BoxPlotConfidence + */ + @Test + public void testBoxPlotConfidence() { + // TODO: test BoxPlotConfidence + } + + /** + * Test the property 'min' + */ + @Test + public void minTest() { + // TODO: test min + } + + /** + * Test the property 'max' + */ + @Test + public void maxTest() { + // TODO: test max + } + + /** + * Test the property 'average' + */ + @Test + public void averageTest() { + // TODO: test average + } + + /** + * Test the property 'upperQuartile' + */ + @Test + public void upperQuartileTest() { + // TODO: test upperQuartile + } + + /** + * Test the property 'lowerQuartile' + */ + @Test + public void lowerQuartileTest() { + // TODO: test lowerQuartile + } + + /** + * Test the property 'positiveCount' + */ + @Test + public void positiveCountTest() { + // TODO: test positiveCount + } + + /** + * Test the property 'negativeCount' + */ + @Test + public void negativeCountTest() { + // TODO: test negativeCount + } + +} diff --git a/src/test/java/ai/reveng/model/OriginTest.java b/src/test/java/ai/reveng/model/OriginTest.java new file mode 100644 index 0000000..7ae7834 --- /dev/null +++ b/src/test/java/ai/reveng/model/OriginTest.java @@ -0,0 +1,31 @@ +/* + * 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.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for Origin + */ +public class OriginTest { + /** + * Model tests for Origin + */ + @Test + public void testOrigin() { + // TODO: test Origin + } + +} diff --git a/src/test/java/ai/reveng/model/TagConfidenceBodyTest.java b/src/test/java/ai/reveng/model/TagConfidenceBodyTest.java new file mode 100644 index 0000000..6824d36 --- /dev/null +++ b/src/test/java/ai/reveng/model/TagConfidenceBodyTest.java @@ -0,0 +1,50 @@ +/* + * RevEng.AI API + * RevEng.AI is Similarity Search Engine for executable binaries + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import ai.reveng.model.Tags; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for TagConfidenceBody + */ +public class TagConfidenceBodyTest { + private final TagConfidenceBody model = new TagConfidenceBody(); + + /** + * Model tests for TagConfidenceBody + */ + @Test + public void testTagConfidenceBody() { + // TODO: test TagConfidenceBody + } + + /** + * Test the property 'tags' + */ + @Test + public void tagsTest() { + // TODO: test tags + } + +} diff --git a/src/test/java/ai/reveng/model/TagOriginBoxPlotConfidenceTest.java b/src/test/java/ai/reveng/model/TagOriginBoxPlotConfidenceTest.java new file mode 100644 index 0000000..0738835 --- /dev/null +++ b/src/test/java/ai/reveng/model/TagOriginBoxPlotConfidenceTest.java @@ -0,0 +1,57 @@ +/* + * 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.BoxPlotConfidence; +import ai.reveng.model.Tags; +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 TagOriginBoxPlotConfidence + */ +public class TagOriginBoxPlotConfidenceTest { + private final TagOriginBoxPlotConfidence model = new TagOriginBoxPlotConfidence(); + + /** + * Model tests for TagOriginBoxPlotConfidence + */ + @Test + public void testTagOriginBoxPlotConfidence() { + // TODO: test TagOriginBoxPlotConfidence + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'boxPlot' + */ + @Test + public void boxPlotTest() { + // TODO: test boxPlot + } + +} diff --git a/src/test/java/ai/reveng/model/TagsTest.java b/src/test/java/ai/reveng/model/TagsTest.java new file mode 100644 index 0000000..b14566a --- /dev/null +++ b/src/test/java/ai/reveng/model/TagsTest.java @@ -0,0 +1,56 @@ +/* + * 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.Origin; +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 Tags + */ +public class TagsTest { + private final Tags model = new Tags(); + + /** + * Model tests for Tags + */ + @Test + public void testTags() { + // TODO: test Tags + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + +}