diff --git a/.sdk-version b/.sdk-version index a12e6bf..3a74886 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.91.1 +v3.92.0 diff --git a/README.md b/README.md index a62405a..b5c16e6 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.91.1 + 3.92.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.91.1" + implementation "ai.reveng:sdk:3.92.0" } ``` @@ -141,6 +141,8 @@ Class | Method | HTTP request | Description *CollectionsApi* | [**v3CreateCollection**](docs/CollectionsApi.md#v3CreateCollection) | **POST** /v3/collections | Create a collection. *CollectionsApi* | [**v3GetCollection**](docs/CollectionsApi.md#v3GetCollection) | **GET** /v3/collections/{collection_id} | Get a collection. *CollectionsApi* | [**v3ListCollections**](docs/CollectionsApi.md#v3ListCollections) | **GET** /v3/collections | List collections. +*CollectionsApi* | [**v3PatchCollectionBinaries**](docs/CollectionsApi.md#v3PatchCollectionBinaries) | **PATCH** /v3/collections/{collection_id}/binaries | Replace the binaries in a collection. +*CollectionsApi* | [**v3PatchCollectionTags**](docs/CollectionsApi.md#v3PatchCollectionTags) | **PATCH** /v3/collections/{collection_id}/tags | Replace the tags on a collection. *ConfigApi* | [**getConfig**](docs/ConfigApi.md#getConfig) | **GET** /v2/config | Get Config *ConversationsApi* | [**cancelRun**](docs/ConversationsApi.md#cancelRun) | **POST** /v2/conversations/{id}/cancel | Cancel an active run *ConversationsApi* | [**confirmTool**](docs/ConversationsApi.md#confirmTool) | **POST** /v2/conversations/{id}/confirm | Approve or reject a pending tool confirmation @@ -533,6 +535,10 @@ Class | Method | HTTP request | Description - [PEModel](docs/PEModel.md) - [PaginationModel](docs/PaginationModel.md) - [Params](docs/Params.md) + - [PatchCollectionBinariesInputBody](docs/PatchCollectionBinariesInputBody.md) + - [PatchCollectionBinariesOutputBody](docs/PatchCollectionBinariesOutputBody.md) + - [PatchCollectionTagsInputBody](docs/PatchCollectionTagsInputBody.md) + - [PatchCollectionTagsOutputBody](docs/PatchCollectionTagsOutputBody.md) - [PatchCommentBody](docs/PatchCommentBody.md) - [Platform](docs/Platform.md) - [PriceOutput](docs/PriceOutput.md) diff --git a/build.gradle b/build.gradle index 711af77..140aa13 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.91.1' +version = '3.92.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.91.1") + coordinates("ai.reveng", "sdk", "3.92.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 020c051..575e50f 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "3.91.1", + version := "3.92.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/CollectionsApi.md b/docs/CollectionsApi.md index adeb77d..abebfe9 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -14,6 +14,8 @@ All URIs are relative to *https://api.reveng.ai* | [**v3CreateCollection**](CollectionsApi.md#v3CreateCollection) | **POST** /v3/collections | Create a collection. | | [**v3GetCollection**](CollectionsApi.md#v3GetCollection) | **GET** /v3/collections/{collection_id} | Get a collection. | | [**v3ListCollections**](CollectionsApi.md#v3ListCollections) | **GET** /v3/collections | List collections. | +| [**v3PatchCollectionBinaries**](CollectionsApi.md#v3PatchCollectionBinaries) | **PATCH** /v3/collections/{collection_id}/binaries | Replace the binaries in a collection. | +| [**v3PatchCollectionTags**](CollectionsApi.md#v3PatchCollectionTags) | **PATCH** /v3/collections/{collection_id}/tags | Replace the tags on a collection. | @@ -767,3 +769,153 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3PatchCollectionBinaries** +> PatchCollectionBinariesOutputBody v3PatchCollectionBinaries(collectionId, patchCollectionBinariesInputBody) + +Replace the binaries in a collection. + +Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### 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.CollectionsApi; + +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"); + + CollectionsApi apiInstance = new CollectionsApi(defaultClient); + Long collectionId = 56L; // Long | + PatchCollectionBinariesInputBody patchCollectionBinariesInputBody = new PatchCollectionBinariesInputBody(); // PatchCollectionBinariesInputBody | + try { + PatchCollectionBinariesOutputBody result = apiInstance.v3PatchCollectionBinaries(collectionId, patchCollectionBinariesInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CollectionsApi#v3PatchCollectionBinaries"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **collectionId** | **Long**| | | +| **patchCollectionBinariesInputBody** | [**PatchCollectionBinariesInputBody**](PatchCollectionBinariesInputBody.md)| | | + +### Return type + +[**PatchCollectionBinariesOutputBody**](PatchCollectionBinariesOutputBody.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** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + + +# **v3PatchCollectionTags** +> PatchCollectionTagsOutputBody v3PatchCollectionTags(collectionId, patchCollectionTagsInputBody) + +Replace the tags on a collection. + +Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### 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.CollectionsApi; + +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"); + + CollectionsApi apiInstance = new CollectionsApi(defaultClient); + Long collectionId = 56L; // Long | + PatchCollectionTagsInputBody patchCollectionTagsInputBody = new PatchCollectionTagsInputBody(); // PatchCollectionTagsInputBody | + try { + PatchCollectionTagsOutputBody result = apiInstance.v3PatchCollectionTags(collectionId, patchCollectionTagsInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CollectionsApi#v3PatchCollectionTags"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **collectionId** | **Long**| | | +| **patchCollectionTagsInputBody** | [**PatchCollectionTagsInputBody**](PatchCollectionTagsInputBody.md)| | | + +### Return type + +[**PatchCollectionTagsOutputBody**](PatchCollectionTagsOutputBody.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** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/PatchCollectionBinariesInputBody.md b/docs/PatchCollectionBinariesInputBody.md new file mode 100644 index 0000000..b456843 --- /dev/null +++ b/docs/PatchCollectionBinariesInputBody.md @@ -0,0 +1,13 @@ + + +# PatchCollectionBinariesInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaries** | **List<Long>** | Binary IDs to set on the collection. The collection's binaries are fully replaced with this list. | | + + + diff --git a/docs/PatchCollectionBinariesOutputBody.md b/docs/PatchCollectionBinariesOutputBody.md new file mode 100644 index 0000000..da1eec5 --- /dev/null +++ b/docs/PatchCollectionBinariesOutputBody.md @@ -0,0 +1,13 @@ + + +# PatchCollectionBinariesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaries** | **List<Binary>** | | | + + + diff --git a/docs/PatchCollectionTagsInputBody.md b/docs/PatchCollectionTagsInputBody.md new file mode 100644 index 0000000..774264c --- /dev/null +++ b/docs/PatchCollectionTagsInputBody.md @@ -0,0 +1,13 @@ + + +# PatchCollectionTagsInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tags** | **List<String>** | Tags to set on the collection. The collection's tags are fully replaced with this list. | | + + + diff --git a/docs/PatchCollectionTagsOutputBody.md b/docs/PatchCollectionTagsOutputBody.md new file mode 100644 index 0000000..539edfb --- /dev/null +++ b/docs/PatchCollectionTagsOutputBody.md @@ -0,0 +1,13 @@ + + +# PatchCollectionTagsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tags** | **List<String>** | | | + + + diff --git a/docs/SearchApi.md b/docs/SearchApi.md index 5554745..5eb2ae8 100644 --- a/docs/SearchApi.md +++ b/docs/SearchApi.md @@ -12,7 +12,7 @@ All URIs are relative to *https://api.reveng.ai* # **searchBinaries** -> BaseResponseBinarySearchResponse searchBinaries(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly) +> BaseResponseBinarySearchResponse searchBinaries(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId) Binaries search @@ -47,8 +47,9 @@ public class Example { List tags = Arrays.asList(); // List | The tags to be searched for String modelName = "modelName_example"; // String | The name of the model used to analyze the binary the function belongs to Boolean userFilesOnly = false; // Boolean | Whether to only search user's uploaded files + Integer excludeBinaryId = 56; // Integer | A binary ID to exclude from the results try { - BaseResponseBinarySearchResponse result = apiInstance.searchBinaries(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly); + BaseResponseBinarySearchResponse result = apiInstance.searchBinaries(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling SearchApi#searchBinaries"); @@ -72,6 +73,7 @@ public class Example { | **tags** | [**List<String>**](String.md)| The tags to be searched for | [optional] | | **modelName** | **String**| The name of the model used to analyze the binary the function belongs to | [optional] | | **userFilesOnly** | **Boolean**| Whether to only search user's uploaded files | [optional] [default to false] | +| **excludeBinaryId** | **Integer**| A binary ID to exclude from the results | [optional] | ### Return type diff --git a/pom.xml b/pom.xml index 65dfb62..4a4e6d6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.91.1 + 3.92.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/CollectionsApi.java b/src/main/java/ai/reveng/api/CollectionsApi.java index 7036720..6052b27 100644 --- a/src/main/java/ai/reveng/api/CollectionsApi.java +++ b/src/main/java/ai/reveng/api/CollectionsApi.java @@ -44,6 +44,10 @@ import ai.reveng.model.GetCollectionOutputBody; import ai.reveng.model.ListCollectionsOutputBody; import ai.reveng.model.Order; +import ai.reveng.model.PatchCollectionBinariesInputBody; +import ai.reveng.model.PatchCollectionBinariesOutputBody; +import ai.reveng.model.PatchCollectionTagsInputBody; +import ai.reveng.model.PatchCollectionTagsOutputBody; import java.lang.reflect.Type; import java.util.ArrayList; @@ -1604,4 +1608,310 @@ public okhttp3.Call v3ListCollectionsAsync(@javax.annotation.Nullable String sea localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3PatchCollectionBinaries + * @param collectionId (required) + * @param patchCollectionBinariesInputBody (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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3PatchCollectionBinariesCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionBinariesInputBody patchCollectionBinariesInputBody, 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 = patchCollectionBinariesInputBody; + + // create path and map variables + String localVarPath = "/v3/collections/{collection_id}/binaries" + .replace("{" + "collection_id" + "}", localVarApiClient.escapeString(collectionId.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, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3PatchCollectionBinariesValidateBeforeCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionBinariesInputBody patchCollectionBinariesInputBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new ApiException("Missing the required parameter 'collectionId' when calling v3PatchCollectionBinaries(Async)"); + } + + // verify the required parameter 'patchCollectionBinariesInputBody' is set + if (patchCollectionBinariesInputBody == null) { + throw new ApiException("Missing the required parameter 'patchCollectionBinariesInputBody' when calling v3PatchCollectionBinaries(Async)"); + } + + return v3PatchCollectionBinariesCall(collectionId, patchCollectionBinariesInputBody, _callback); + + } + + /** + * Replace the binaries in a collection. + * Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param collectionId (required) + * @param patchCollectionBinariesInputBody (required) + * @return PatchCollectionBinariesOutputBody + * @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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public PatchCollectionBinariesOutputBody v3PatchCollectionBinaries(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionBinariesInputBody patchCollectionBinariesInputBody) throws ApiException { + ApiResponse localVarResp = v3PatchCollectionBinariesWithHttpInfo(collectionId, patchCollectionBinariesInputBody); + return localVarResp.getData(); + } + + /** + * Replace the binaries in a collection. + * Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param collectionId (required) + * @param patchCollectionBinariesInputBody (required) + * @return ApiResponse<PatchCollectionBinariesOutputBody> + * @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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3PatchCollectionBinariesWithHttpInfo(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionBinariesInputBody patchCollectionBinariesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3PatchCollectionBinariesValidateBeforeCall(collectionId, patchCollectionBinariesInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Replace the binaries in a collection. (asynchronously) + * Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param collectionId (required) + * @param patchCollectionBinariesInputBody (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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3PatchCollectionBinariesAsync(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionBinariesInputBody patchCollectionBinariesInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3PatchCollectionBinariesValidateBeforeCall(collectionId, patchCollectionBinariesInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3PatchCollectionTags + * @param collectionId (required) + * @param patchCollectionTagsInputBody (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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3PatchCollectionTagsCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionTagsInputBody patchCollectionTagsInputBody, 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 = patchCollectionTagsInputBody; + + // create path and map variables + String localVarPath = "/v3/collections/{collection_id}/tags" + .replace("{" + "collection_id" + "}", localVarApiClient.escapeString(collectionId.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, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3PatchCollectionTagsValidateBeforeCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionTagsInputBody patchCollectionTagsInputBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new ApiException("Missing the required parameter 'collectionId' when calling v3PatchCollectionTags(Async)"); + } + + // verify the required parameter 'patchCollectionTagsInputBody' is set + if (patchCollectionTagsInputBody == null) { + throw new ApiException("Missing the required parameter 'patchCollectionTagsInputBody' when calling v3PatchCollectionTags(Async)"); + } + + return v3PatchCollectionTagsCall(collectionId, patchCollectionTagsInputBody, _callback); + + } + + /** + * Replace the tags on a collection. + * Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param collectionId (required) + * @param patchCollectionTagsInputBody (required) + * @return PatchCollectionTagsOutputBody + * @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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public PatchCollectionTagsOutputBody v3PatchCollectionTags(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionTagsInputBody patchCollectionTagsInputBody) throws ApiException { + ApiResponse localVarResp = v3PatchCollectionTagsWithHttpInfo(collectionId, patchCollectionTagsInputBody); + return localVarResp.getData(); + } + + /** + * Replace the tags on a collection. + * Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param collectionId (required) + * @param patchCollectionTagsInputBody (required) + * @return ApiResponse<PatchCollectionTagsOutputBody> + * @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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3PatchCollectionTagsWithHttpInfo(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionTagsInputBody patchCollectionTagsInputBody) throws ApiException { + okhttp3.Call localVarCall = v3PatchCollectionTagsValidateBeforeCall(collectionId, patchCollectionTagsInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Replace the tags on a collection. (asynchronously) + * Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param collectionId (required) + * @param patchCollectionTagsInputBody (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 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3PatchCollectionTagsAsync(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull PatchCollectionTagsInputBody patchCollectionTagsInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3PatchCollectionTagsValidateBeforeCall(collectionId, patchCollectionTagsInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/api/SearchApi.java b/src/main/java/ai/reveng/api/SearchApi.java index c04d6fa..3850436 100644 --- a/src/main/java/ai/reveng/api/SearchApi.java +++ b/src/main/java/ai/reveng/api/SearchApi.java @@ -87,6 +87,7 @@ public void setCustomBaseUrl(String customBaseUrl) { * @param tags The tags to be searched for (optional) * @param modelName The name of the model used to analyze the binary the function belongs to (optional) * @param userFilesOnly Whether to only search user's uploaded files (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -98,7 +99,7 @@ public void setCustomBaseUrl(String customBaseUrl) { 422 You must provide at least one of the filters; partial_name, partial_sha256, tags or model_name to search - */ - public okhttp3.Call searchBinariesCall(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, final ApiCallback _callback) throws ApiException { + public okhttp3.Call searchBinariesCall(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Integer excludeBinaryId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -151,6 +152,10 @@ public okhttp3.Call searchBinariesCall(@javax.annotation.Nullable Integer page, localVarQueryParams.addAll(localVarApiClient.parameterToPair("user_files_only", userFilesOnly)); } + if (excludeBinaryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("exclude_binary_id", excludeBinaryId)); + } + final String[] localVarAccepts = { "application/json" }; @@ -171,8 +176,8 @@ public okhttp3.Call searchBinariesCall(@javax.annotation.Nullable Integer page, } @SuppressWarnings("rawtypes") - private okhttp3.Call searchBinariesValidateBeforeCall(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, final ApiCallback _callback) throws ApiException { - return searchBinariesCall(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, _callback); + private okhttp3.Call searchBinariesValidateBeforeCall(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Integer excludeBinaryId, final ApiCallback _callback) throws ApiException { + return searchBinariesCall(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, _callback); } @@ -186,6 +191,7 @@ private okhttp3.Call searchBinariesValidateBeforeCall(@javax.annotation.Nullable * @param tags The tags to be searched for (optional) * @param modelName The name of the model used to analyze the binary the function belongs to (optional) * @param userFilesOnly Whether to only search user's uploaded files (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) * @return BaseResponseBinarySearchResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -196,8 +202,8 @@ private okhttp3.Call searchBinariesValidateBeforeCall(@javax.annotation.Nullable 422 You must provide at least one of the filters; partial_name, partial_sha256, tags or model_name to search - */ - public BaseResponseBinarySearchResponse searchBinaries(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly) throws ApiException { - ApiResponse localVarResp = searchBinariesWithHttpInfo(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly); + public BaseResponseBinarySearchResponse searchBinaries(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Integer excludeBinaryId) throws ApiException { + ApiResponse localVarResp = searchBinariesWithHttpInfo(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId); return localVarResp.getData(); } @@ -211,6 +217,7 @@ public BaseResponseBinarySearchResponse searchBinaries(@javax.annotation.Nullabl * @param tags The tags to be searched for (optional) * @param modelName The name of the model used to analyze the binary the function belongs to (optional) * @param userFilesOnly Whether to only search user's uploaded files (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) * @return ApiResponse<BaseResponseBinarySearchResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -221,8 +228,8 @@ public BaseResponseBinarySearchResponse searchBinaries(@javax.annotation.Nullabl 422 You must provide at least one of the filters; partial_name, partial_sha256, tags or model_name to search - */ - public ApiResponse searchBinariesWithHttpInfo(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly) throws ApiException { - okhttp3.Call localVarCall = searchBinariesValidateBeforeCall(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, null); + public ApiResponse searchBinariesWithHttpInfo(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Integer excludeBinaryId) throws ApiException { + okhttp3.Call localVarCall = searchBinariesValidateBeforeCall(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -237,6 +244,7 @@ public ApiResponse searchBinariesWithHttpInfo( * @param tags The tags to be searched for (optional) * @param modelName The name of the model used to analyze the binary the function belongs to (optional) * @param userFilesOnly Whether to only search user's uploaded files (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) * @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 @@ -248,9 +256,9 @@ public ApiResponse searchBinariesWithHttpInfo( 422 You must provide at least one of the filters; partial_name, partial_sha256, tags or model_name to search - */ - public okhttp3.Call searchBinariesAsync(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, final ApiCallback _callback) throws ApiException { + public okhttp3.Call searchBinariesAsync(@javax.annotation.Nullable Integer page, @javax.annotation.Nullable Integer pageSize, @javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Integer excludeBinaryId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = searchBinariesValidateBeforeCall(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, _callback); + okhttp3.Call localVarCall = searchBinariesValidateBeforeCall(page, pageSize, partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, _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 1ac6756..d34ad86 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -146,7 +146,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.91.1/java"); + setUserAgent("OpenAPI-Generator/3.92.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/ai/reveng/invoker/Configuration.java b/src/main/java/ai/reveng/invoker/Configuration.java index 3a8d856..989cbc2 100644 --- a/src/main/java/ai/reveng/invoker/Configuration.java +++ b/src/main/java/ai/reveng/invoker/Configuration.java @@ -18,7 +18,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "3.91.1"; + public static final String VERSION = "3.92.0"; private static final AtomicReference defaultApiClient = new AtomicReference<>(); private static volatile Supplier apiClientFactory = ApiClient::new; diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index 699307f..41b56de 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -395,6 +395,10 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PEModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PaginationModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Params.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PatchCollectionBinariesInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PatchCollectionBinariesOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PatchCollectionTagsInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PatchCollectionTagsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PatchCommentBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PriceOutput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PriceSummary.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/PatchCollectionBinariesInputBody.java b/src/main/java/ai/reveng/model/PatchCollectionBinariesInputBody.java new file mode 100644 index 0000000..116228b --- /dev/null +++ b/src/main/java/ai/reveng/model/PatchCollectionBinariesInputBody.java @@ -0,0 +1,307 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.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; + +/** + * PatchCollectionBinariesInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCollectionBinariesInputBody { + public static final String SERIALIZED_NAME_BINARIES = "binaries"; + @SerializedName(SERIALIZED_NAME_BINARIES) + @javax.annotation.Nullable + private List binaries; + + public PatchCollectionBinariesInputBody() { + } + + public PatchCollectionBinariesInputBody binaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + return this; + } + + public PatchCollectionBinariesInputBody addBinariesItem(Long binariesItem) { + if (this.binaries == null) { + this.binaries = new ArrayList<>(); + } + this.binaries.add(binariesItem); + return this; + } + + /** + * Binary IDs to set on the collection. The collection's binaries are fully replaced with this list. + * @return binaries + */ + @javax.annotation.Nullable + public List getBinaries() { + return binaries; + } + + public void setBinaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + } + + /** + * 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 PatchCollectionBinariesInputBody instance itself + */ + public PatchCollectionBinariesInputBody 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; + } + PatchCollectionBinariesInputBody patchCollectionBinariesInputBody = (PatchCollectionBinariesInputBody) o; + return Objects.equals(this.binaries, patchCollectionBinariesInputBody.binaries)&& + Objects.equals(this.additionalProperties, patchCollectionBinariesInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(binaries, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCollectionBinariesInputBody {\n"); + sb.append(" binaries: ").append(toIndentedString(binaries)).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("binaries")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("binaries")); + } + + /** + * 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 PatchCollectionBinariesInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCollectionBinariesInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in PatchCollectionBinariesInputBody is not found in the empty JSON string", PatchCollectionBinariesInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchCollectionBinariesInputBody.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 required json array is present + if (jsonObj.get("binaries") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("binaries").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `binaries` to be an array in the JSON string but got `%s`", jsonObj.get("binaries").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCollectionBinariesInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCollectionBinariesInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCollectionBinariesInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCollectionBinariesInputBody 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 PatchCollectionBinariesInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PatchCollectionBinariesInputBody 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 PatchCollectionBinariesInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCollectionBinariesInputBody + * @throws IOException if the JSON string is invalid with respect to PatchCollectionBinariesInputBody + */ + public static PatchCollectionBinariesInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCollectionBinariesInputBody.class); + } + + /** + * Convert an instance of PatchCollectionBinariesInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/PatchCollectionBinariesOutputBody.java b/src/main/java/ai/reveng/model/PatchCollectionBinariesOutputBody.java new file mode 100644 index 0000000..b7259f8 --- /dev/null +++ b/src/main/java/ai/reveng/model/PatchCollectionBinariesOutputBody.java @@ -0,0 +1,308 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.Binary; +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; + +/** + * PatchCollectionBinariesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCollectionBinariesOutputBody { + public static final String SERIALIZED_NAME_BINARIES = "binaries"; + @SerializedName(SERIALIZED_NAME_BINARIES) + @javax.annotation.Nullable + private List binaries; + + public PatchCollectionBinariesOutputBody() { + } + + public PatchCollectionBinariesOutputBody binaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + return this; + } + + public PatchCollectionBinariesOutputBody addBinariesItem(Binary binariesItem) { + if (this.binaries == null) { + this.binaries = new ArrayList<>(); + } + this.binaries.add(binariesItem); + return this; + } + + /** + * Get binaries + * @return binaries + */ + @javax.annotation.Nullable + public List getBinaries() { + return binaries; + } + + public void setBinaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + } + + /** + * 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 PatchCollectionBinariesOutputBody instance itself + */ + public PatchCollectionBinariesOutputBody 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; + } + PatchCollectionBinariesOutputBody patchCollectionBinariesOutputBody = (PatchCollectionBinariesOutputBody) o; + return Objects.equals(this.binaries, patchCollectionBinariesOutputBody.binaries)&& + Objects.equals(this.additionalProperties, patchCollectionBinariesOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(binaries, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCollectionBinariesOutputBody {\n"); + sb.append(" binaries: ").append(toIndentedString(binaries)).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("binaries")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("binaries")); + } + + /** + * 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 PatchCollectionBinariesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCollectionBinariesOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in PatchCollectionBinariesOutputBody is not found in the empty JSON string", PatchCollectionBinariesOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchCollectionBinariesOutputBody.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 required json array is present + if (jsonObj.get("binaries") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("binaries").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `binaries` to be an array in the JSON string but got `%s`", jsonObj.get("binaries").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCollectionBinariesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCollectionBinariesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCollectionBinariesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCollectionBinariesOutputBody 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 PatchCollectionBinariesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PatchCollectionBinariesOutputBody 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 PatchCollectionBinariesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCollectionBinariesOutputBody + * @throws IOException if the JSON string is invalid with respect to PatchCollectionBinariesOutputBody + */ + public static PatchCollectionBinariesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCollectionBinariesOutputBody.class); + } + + /** + * Convert an instance of PatchCollectionBinariesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/PatchCollectionTagsInputBody.java b/src/main/java/ai/reveng/model/PatchCollectionTagsInputBody.java new file mode 100644 index 0000000..c797371 --- /dev/null +++ b/src/main/java/ai/reveng/model/PatchCollectionTagsInputBody.java @@ -0,0 +1,307 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.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; + +/** + * PatchCollectionTagsInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCollectionTagsInputBody { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public PatchCollectionTagsInputBody() { + } + + public PatchCollectionTagsInputBody tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PatchCollectionTagsInputBody addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags to set on the collection. The collection's tags are fully replaced with this list. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable 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 PatchCollectionTagsInputBody instance itself + */ + public PatchCollectionTagsInputBody 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; + } + PatchCollectionTagsInputBody patchCollectionTagsInputBody = (PatchCollectionTagsInputBody) o; + return Objects.equals(this.tags, patchCollectionTagsInputBody.tags)&& + Objects.equals(this.additionalProperties, patchCollectionTagsInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCollectionTagsInputBody {\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 PatchCollectionTagsInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCollectionTagsInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in PatchCollectionTagsInputBody is not found in the empty JSON string", PatchCollectionTagsInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchCollectionTagsInputBody.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 required json array is present + if (jsonObj.get("tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCollectionTagsInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCollectionTagsInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCollectionTagsInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCollectionTagsInputBody 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 PatchCollectionTagsInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PatchCollectionTagsInputBody 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 PatchCollectionTagsInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCollectionTagsInputBody + * @throws IOException if the JSON string is invalid with respect to PatchCollectionTagsInputBody + */ + public static PatchCollectionTagsInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCollectionTagsInputBody.class); + } + + /** + * Convert an instance of PatchCollectionTagsInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/PatchCollectionTagsOutputBody.java b/src/main/java/ai/reveng/model/PatchCollectionTagsOutputBody.java new file mode 100644 index 0000000..34ca49b --- /dev/null +++ b/src/main/java/ai/reveng/model/PatchCollectionTagsOutputBody.java @@ -0,0 +1,307 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.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; + +/** + * PatchCollectionTagsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PatchCollectionTagsOutputBody { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public PatchCollectionTagsOutputBody() { + } + + public PatchCollectionTagsOutputBody tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public PatchCollectionTagsOutputBody addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable 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 PatchCollectionTagsOutputBody instance itself + */ + public PatchCollectionTagsOutputBody 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; + } + PatchCollectionTagsOutputBody patchCollectionTagsOutputBody = (PatchCollectionTagsOutputBody) o; + return Objects.equals(this.tags, patchCollectionTagsOutputBody.tags)&& + Objects.equals(this.additionalProperties, patchCollectionTagsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatchCollectionTagsOutputBody {\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 PatchCollectionTagsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatchCollectionTagsOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in PatchCollectionTagsOutputBody is not found in the empty JSON string", PatchCollectionTagsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatchCollectionTagsOutputBody.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 required json array is present + if (jsonObj.get("tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatchCollectionTagsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatchCollectionTagsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatchCollectionTagsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatchCollectionTagsOutputBody 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 PatchCollectionTagsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PatchCollectionTagsOutputBody 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 PatchCollectionTagsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatchCollectionTagsOutputBody + * @throws IOException if the JSON string is invalid with respect to PatchCollectionTagsOutputBody + */ + public static PatchCollectionTagsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatchCollectionTagsOutputBody.class); + } + + /** + * Convert an instance of PatchCollectionTagsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +