diff --git a/.sdk-version b/.sdk-version index 3a1a0ae..f557686 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.124.0 +v3.130.1 diff --git a/README.md b/README.md index af40b97..811eab2 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.124.0 + 3.130.1 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.124.0" + implementation "ai.reveng:sdk:3.130.1" } ``` @@ -146,6 +146,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 +*CollectionsApi* | [**v3AddCollectionBinaries**](docs/CollectionsApi.md#v3AddCollectionBinaries) | **POST** /v3/collections/{collection_id}/binaries | Add binaries to a collection. *CollectionsApi* | [**v3CreateCollection**](docs/CollectionsApi.md#v3CreateCollection) | **POST** /v3/collections | Create a collection. *CollectionsApi* | [**v3DeleteCollection**](docs/CollectionsApi.md#v3DeleteCollection) | **DELETE** /v3/collections/{collection_id} | Delete a collection. *CollectionsApi* | [**v3GetCollection**](docs/CollectionsApi.md#v3GetCollection) | **GET** /v3/collections/{collection_id} | Get a collection. @@ -153,6 +154,7 @@ Class | Method | HTTP request | Description *CollectionsApi* | [**v3PatchCollection**](docs/CollectionsApi.md#v3PatchCollection) | **PATCH** /v3/collections/{collection_id} | Update a collection. *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. +*CollectionsApi* | [**v3RemoveCollectionBinaries**](docs/CollectionsApi.md#v3RemoveCollectionBinaries) | **DELETE** /v3/collections/{collection_id}/binaries | Remove binaries from 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 @@ -242,6 +244,7 @@ Class | Method | HTTP request | Description - [AIDecompInverseStringMapItem](docs/AIDecompInverseStringMapItem.md) - [APIError](docs/APIError.md) - [AddCalleeInputBody](docs/AddCalleeInputBody.md) + - [AddCollectionBinariesInputBody](docs/AddCollectionBinariesInputBody.md) - [AddIssuerDomainInputBody](docs/AddIssuerDomainInputBody.md) - [AddOwnerInputBody](docs/AddOwnerInputBody.md) - [AddTeamMemberInputBody](docs/AddTeamMemberInputBody.md) @@ -627,6 +630,7 @@ Class | Method | HTTP request | Description - [RegisterUserInputBody](docs/RegisterUserInputBody.md) - [RegistryOperation](docs/RegistryOperation.md) - [RelativeBinaryResponse](docs/RelativeBinaryResponse.md) + - [RemoveCollectionBinariesInputBody](docs/RemoveCollectionBinariesInputBody.md) - [RenameAppliedEvent](docs/RenameAppliedEvent.md) - [RenameInputBody](docs/RenameInputBody.md) - [RenameOutputBody](docs/RenameOutputBody.md) diff --git a/build.gradle b/build.gradle index 29d41ac..1622e7f 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.124.0' +version = '3.130.1' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.124.0") + coordinates("ai.reveng", "sdk", "3.130.1") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index c09bd84..7cede5d 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.124.0", + version := "3.130.1", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AddCollectionBinariesInputBody.md b/docs/AddCollectionBinariesInputBody.md new file mode 100644 index 0000000..92c583a --- /dev/null +++ b/docs/AddCollectionBinariesInputBody.md @@ -0,0 +1,13 @@ + + +# AddCollectionBinariesInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaries** | **List<Long>** | Binary IDs to add to the collection. Binary IDs already linked to the collection are ignored. | | + + + diff --git a/docs/CollectionsApi.md b/docs/CollectionsApi.md index 25d879a..c2d7b8e 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -11,6 +11,7 @@ All URIs are relative to *https://api.reveng.ai* | [**updateCollection**](CollectionsApi.md#updateCollection) | **PATCH** /v2/collections/{collection_id} | Updates a collection | | [**updateCollectionBinaries**](CollectionsApi.md#updateCollectionBinaries) | **PATCH** /v2/collections/{collection_id}/binaries | Updates a collection binaries | | [**updateCollectionTags**](CollectionsApi.md#updateCollectionTags) | **PATCH** /v2/collections/{collection_id}/tags | Updates a collection tags | +| [**v3AddCollectionBinaries**](CollectionsApi.md#v3AddCollectionBinaries) | **POST** /v3/collections/{collection_id}/binaries | Add binaries to a collection. | | [**v3CreateCollection**](CollectionsApi.md#v3CreateCollection) | **POST** /v3/collections | Create a collection. | | [**v3DeleteCollection**](CollectionsApi.md#v3DeleteCollection) | **DELETE** /v3/collections/{collection_id} | Delete a collection. | | [**v3GetCollection**](CollectionsApi.md#v3GetCollection) | **GET** /v3/collections/{collection_id} | Get a collection. | @@ -18,6 +19,7 @@ All URIs are relative to *https://api.reveng.ai* | [**v3PatchCollection**](CollectionsApi.md#v3PatchCollection) | **PATCH** /v3/collections/{collection_id} | Update a collection. | | [**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. | +| [**v3RemoveCollectionBinaries**](CollectionsApi.md#v3RemoveCollectionBinaries) | **DELETE** /v3/collections/{collection_id}/binaries | Remove binaries from a collection. | @@ -564,6 +566,84 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **v3AddCollectionBinaries** +> v3AddCollectionBinaries(collectionId, addCollectionBinariesInputBody) + +Add binaries to a collection. + +Links the supplied binaries to a collection without affecting any binaries already linked. Binary IDs already linked to the collection are ignored. **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"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + CollectionsApi apiInstance = new CollectionsApi(defaultClient); + Long collectionId = 56L; // Long | + AddCollectionBinariesInputBody addCollectionBinariesInputBody = new AddCollectionBinariesInputBody(); // AddCollectionBinariesInputBody | + try { + apiInstance.v3AddCollectionBinaries(collectionId, addCollectionBinariesInputBody); + } catch (ApiException e) { + System.err.println("Exception when calling CollectionsApi#v3AddCollectionBinaries"); + 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**| | | +| **addCollectionBinariesInputBody** | [**AddCollectionBinariesInputBody**](AddCollectionBinariesInputBody.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3CreateCollection** > CreateCollectionOutputBody v3CreateCollection(createCollectionInputBody) @@ -1125,3 +1205,81 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3RemoveCollectionBinaries** +> v3RemoveCollectionBinaries(collectionId, removeCollectionBinariesInputBody) + +Remove binaries from a collection. + +Unlinks the supplied binaries from a collection without affecting any other binaries linked to it. Binary IDs not linked to the collection are ignored. **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"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + CollectionsApi apiInstance = new CollectionsApi(defaultClient); + Long collectionId = 56L; // Long | + RemoveCollectionBinariesInputBody removeCollectionBinariesInputBody = new RemoveCollectionBinariesInputBody(); // RemoveCollectionBinariesInputBody | + try { + apiInstance.v3RemoveCollectionBinaries(collectionId, removeCollectionBinariesInputBody); + } catch (ApiException e) { + System.err.println("Exception when calling CollectionsApi#v3RemoveCollectionBinaries"); + 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**| | | +| **removeCollectionBinariesInputBody** | [**RemoveCollectionBinariesInputBody**](RemoveCollectionBinariesInputBody.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/ProductOutput.md b/docs/ProductOutput.md index 9724236..afdaf41 100644 --- a/docs/ProductOutput.md +++ b/docs/ProductOutput.md @@ -13,6 +13,7 @@ |**id** | **String** | Product ID. | | |**name** | **String** | Human-readable product name. | | |**prices** | [**List<PriceOutput>**](PriceOutput.md) | All active recurring prices for this product. | | +|**salesOnly** | **Boolean** | When true, this product is not self-serve purchasable and must be bought via direct sales. | | |**tier** | **String** | User tier associated with this product, if any. | [optional] | diff --git a/docs/RemoveCollectionBinariesInputBody.md b/docs/RemoveCollectionBinariesInputBody.md new file mode 100644 index 0000000..c46d2d2 --- /dev/null +++ b/docs/RemoveCollectionBinariesInputBody.md @@ -0,0 +1,13 @@ + + +# RemoveCollectionBinariesInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaries** | **List<Long>** | Binary IDs to remove from the collection. Binary IDs not linked to the collection are ignored. | | + + + diff --git a/pom.xml b/pom.xml index 6cf4fc4..0c578fa 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.124.0 + 3.130.1 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 0e2274c..1e8a2d8 100644 --- a/src/main/java/ai/reveng/api/CollectionsApi.java +++ b/src/main/java/ai/reveng/api/CollectionsApi.java @@ -27,6 +27,7 @@ import ai.reveng.model.APIError; +import ai.reveng.model.AddCollectionBinariesInputBody; import ai.reveng.model.AppApiRestV2CollectionsEnumsOrderBy; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseBool; @@ -50,6 +51,7 @@ import ai.reveng.model.PatchCollectionOutputBody; import ai.reveng.model.PatchCollectionTagsInputBody; import ai.reveng.model.PatchCollectionTagsOutputBody; +import ai.reveng.model.RemoveCollectionBinariesInputBody; import java.lang.reflect.Type; import java.util.ArrayList; @@ -1182,6 +1184,155 @@ public okhttp3.Call updateCollectionTagsAsync(@javax.annotation.Nonnull Integer localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3AddCollectionBinaries + * @param collectionId (required) + * @param addCollectionBinariesInputBody (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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3AddCollectionBinariesCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull AddCollectionBinariesInputBody addCollectionBinariesInputBody, 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 = addCollectionBinariesInputBody; + + // 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", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3AddCollectionBinariesValidateBeforeCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull AddCollectionBinariesInputBody addCollectionBinariesInputBody, 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 v3AddCollectionBinaries(Async)"); + } + + // verify the required parameter 'addCollectionBinariesInputBody' is set + if (addCollectionBinariesInputBody == null) { + throw new ApiException("Missing the required parameter 'addCollectionBinariesInputBody' when calling v3AddCollectionBinaries(Async)"); + } + + return v3AddCollectionBinariesCall(collectionId, addCollectionBinariesInputBody, _callback); + + } + + /** + * Add binaries to a collection. + * Links the supplied binaries to a collection without affecting any binaries already linked. Binary IDs already linked to the collection are ignored. **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 addCollectionBinariesInputBody (required) + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public void v3AddCollectionBinaries(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull AddCollectionBinariesInputBody addCollectionBinariesInputBody) throws ApiException { + v3AddCollectionBinariesWithHttpInfo(collectionId, addCollectionBinariesInputBody); + } + + /** + * Add binaries to a collection. + * Links the supplied binaries to a collection without affecting any binaries already linked. Binary IDs already linked to the collection are ignored. **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 addCollectionBinariesInputBody (required) + * @return ApiResponse<Void> + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3AddCollectionBinariesWithHttpInfo(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull AddCollectionBinariesInputBody addCollectionBinariesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3AddCollectionBinariesValidateBeforeCall(collectionId, addCollectionBinariesInputBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Add binaries to a collection. (asynchronously) + * Links the supplied binaries to a collection without affecting any binaries already linked. Binary IDs already linked to the collection are ignored. **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 addCollectionBinariesInputBody (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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3AddCollectionBinariesAsync(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull AddCollectionBinariesInputBody addCollectionBinariesInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3AddCollectionBinariesValidateBeforeCall(collectionId, addCollectionBinariesInputBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for v3CreateCollection * @param createCollectionInputBody (required) @@ -2275,4 +2426,153 @@ public okhttp3.Call v3PatchCollectionTagsAsync(@javax.annotation.Nonnull Long co localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3RemoveCollectionBinaries + * @param collectionId (required) + * @param removeCollectionBinariesInputBody (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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RemoveCollectionBinariesCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull RemoveCollectionBinariesInputBody removeCollectionBinariesInputBody, 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 = removeCollectionBinariesInputBody; + + // 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", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3RemoveCollectionBinariesValidateBeforeCall(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull RemoveCollectionBinariesInputBody removeCollectionBinariesInputBody, 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 v3RemoveCollectionBinaries(Async)"); + } + + // verify the required parameter 'removeCollectionBinariesInputBody' is set + if (removeCollectionBinariesInputBody == null) { + throw new ApiException("Missing the required parameter 'removeCollectionBinariesInputBody' when calling v3RemoveCollectionBinaries(Async)"); + } + + return v3RemoveCollectionBinariesCall(collectionId, removeCollectionBinariesInputBody, _callback); + + } + + /** + * Remove binaries from a collection. + * Unlinks the supplied binaries from a collection without affecting any other binaries linked to it. Binary IDs not linked to the collection are ignored. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param collectionId (required) + * @param removeCollectionBinariesInputBody (required) + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public void v3RemoveCollectionBinaries(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull RemoveCollectionBinariesInputBody removeCollectionBinariesInputBody) throws ApiException { + v3RemoveCollectionBinariesWithHttpInfo(collectionId, removeCollectionBinariesInputBody); + } + + /** + * Remove binaries from a collection. + * Unlinks the supplied binaries from a collection without affecting any other binaries linked to it. Binary IDs not linked to the collection are ignored. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param collectionId (required) + * @param removeCollectionBinariesInputBody (required) + * @return ApiResponse<Void> + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3RemoveCollectionBinariesWithHttpInfo(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull RemoveCollectionBinariesInputBody removeCollectionBinariesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3RemoveCollectionBinariesValidateBeforeCall(collectionId, removeCollectionBinariesInputBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Remove binaries from a collection. (asynchronously) + * Unlinks the supplied binaries from a collection without affecting any other binaries linked to it. Binary IDs not linked to the collection are ignored. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param collectionId (required) + * @param removeCollectionBinariesInputBody (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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RemoveCollectionBinariesAsync(@javax.annotation.Nonnull Long collectionId, @javax.annotation.Nonnull RemoveCollectionBinariesInputBody removeCollectionBinariesInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3RemoveCollectionBinariesValidateBeforeCall(collectionId, removeCollectionBinariesInputBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 40f4cdc..e042978 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -148,7 +148,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.124.0/java"); + setUserAgent("OpenAPI-Generator/3.130.1/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 c4429b3..c9df578 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.124.0"; + public static final String VERSION = "3.130.1"; 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 e9091ab..a405fbf 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -103,6 +103,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AIDecompInverseStringMapItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.APIError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddCalleeInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddCollectionBinariesInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddIssuerDomainInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddOwnerInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddTeamMemberInputBody.CustomTypeAdapterFactory()); @@ -473,6 +474,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RegisterUserInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RegistryOperation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RelativeBinaryResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RemoveCollectionBinariesInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameAppliedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameOutputBody.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AddCollectionBinariesInputBody.java b/src/main/java/ai/reveng/model/AddCollectionBinariesInputBody.java new file mode 100644 index 0000000..2c2f692 --- /dev/null +++ b/src/main/java/ai/reveng/model/AddCollectionBinariesInputBody.java @@ -0,0 +1,221 @@ +/* + * 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 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 ai.reveng.invoker.JSON; + +/** + * AddCollectionBinariesInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AddCollectionBinariesInputBody { + public static final String SERIALIZED_NAME_BINARIES = "binaries"; + @SerializedName(SERIALIZED_NAME_BINARIES) + @javax.annotation.Nullable + private List binaries; + + public AddCollectionBinariesInputBody() { + } + + public AddCollectionBinariesInputBody binaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + return this; + } + + public AddCollectionBinariesInputBody addBinariesItem(Long binariesItem) { + if (this.binaries == null) { + this.binaries = new ArrayList<>(); + } + this.binaries.add(binariesItem); + return this; + } + + /** + * Binary IDs to add to the collection. Binary IDs already linked to the collection are ignored. + * @return binaries + */ + @javax.annotation.Nullable + public List getBinaries() { + return binaries; + } + + public void setBinaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddCollectionBinariesInputBody addCollectionBinariesInputBody = (AddCollectionBinariesInputBody) o; + return Objects.equals(this.binaries, addCollectionBinariesInputBody.binaries); + } + + @Override + public int hashCode() { + return Objects.hash(binaries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddCollectionBinariesInputBody {\n"); + sb.append(" binaries: ").append(toIndentedString(binaries)).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) { + return o == null ? "null" : 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 AddCollectionBinariesInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddCollectionBinariesInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AddCollectionBinariesInputBody is not found in the empty JSON string", AddCollectionBinariesInputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddCollectionBinariesInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AddCollectionBinariesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddCollectionBinariesInputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.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() && !jsonObj.get("binaries").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.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 (!AddCollectionBinariesInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddCollectionBinariesInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddCollectionBinariesInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddCollectionBinariesInputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddCollectionBinariesInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AddCollectionBinariesInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddCollectionBinariesInputBody + * @throws IOException if the JSON string is invalid with respect to AddCollectionBinariesInputBody + */ + public static AddCollectionBinariesInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddCollectionBinariesInputBody.class); + } + + /** + * Convert an instance of AddCollectionBinariesInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ProductOutput.java b/src/main/java/ai/reveng/model/ProductOutput.java index 9cd4550..ec3e8b8 100644 --- a/src/main/java/ai/reveng/model/ProductOutput.java +++ b/src/main/java/ai/reveng/model/ProductOutput.java @@ -82,6 +82,11 @@ public class ProductOutput { @javax.annotation.Nullable private List prices; + public static final String SERIALIZED_NAME_SALES_ONLY = "sales_only"; + @SerializedName(SERIALIZED_NAME_SALES_ONLY) + @javax.annotation.Nonnull + private Boolean salesOnly; + public static final String SERIALIZED_NAME_TIER = "tier"; @SerializedName(SERIALIZED_NAME_TIER) @javax.annotation.Nullable @@ -220,6 +225,25 @@ public void setPrices(@javax.annotation.Nullable List prices) { } + public ProductOutput salesOnly(@javax.annotation.Nonnull Boolean salesOnly) { + this.salesOnly = salesOnly; + return this; + } + + /** + * When true, this product is not self-serve purchasable and must be bought via direct sales. + * @return salesOnly + */ + @javax.annotation.Nonnull + public Boolean getSalesOnly() { + return salesOnly; + } + + public void setSalesOnly(@javax.annotation.Nonnull Boolean salesOnly) { + this.salesOnly = salesOnly; + } + + public ProductOutput tier(@javax.annotation.Nullable String tier) { this.tier = tier; return this; @@ -255,12 +279,13 @@ public boolean equals(Object o) { Objects.equals(this.id, productOutput.id) && Objects.equals(this.name, productOutput.name) && Objects.equals(this.prices, productOutput.prices) && + Objects.equals(this.salesOnly, productOutput.salesOnly) && Objects.equals(this.tier, productOutput.tier); } @Override public int hashCode() { - return Objects.hash(creditsPerMonth, description, features, id, name, prices, tier); + return Objects.hash(creditsPerMonth, description, features, id, name, prices, salesOnly, tier); } @Override @@ -273,6 +298,7 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" prices: ").append(toIndentedString(prices)).append("\n"); + sb.append(" salesOnly: ").append(toIndentedString(salesOnly)).append("\n"); sb.append(" tier: ").append(toIndentedString(tier)).append("\n"); sb.append("}"); return sb.toString(); @@ -292,10 +318,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("credits_per_month", "description", "features", "id", "name", "prices", "tier")); + openapiFields = new HashSet(Arrays.asList("credits_per_month", "description", "features", "id", "name", "prices", "sales_only", "tier")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("description", "features", "id", "name", "prices")); + openapiRequiredFields = new HashSet(Arrays.asList("description", "features", "id", "name", "prices", "sales_only")); } /** diff --git a/src/main/java/ai/reveng/model/RemoveCollectionBinariesInputBody.java b/src/main/java/ai/reveng/model/RemoveCollectionBinariesInputBody.java new file mode 100644 index 0000000..c79737c --- /dev/null +++ b/src/main/java/ai/reveng/model/RemoveCollectionBinariesInputBody.java @@ -0,0 +1,221 @@ +/* + * 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 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 ai.reveng.invoker.JSON; + +/** + * RemoveCollectionBinariesInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RemoveCollectionBinariesInputBody { + public static final String SERIALIZED_NAME_BINARIES = "binaries"; + @SerializedName(SERIALIZED_NAME_BINARIES) + @javax.annotation.Nullable + private List binaries; + + public RemoveCollectionBinariesInputBody() { + } + + public RemoveCollectionBinariesInputBody binaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + return this; + } + + public RemoveCollectionBinariesInputBody addBinariesItem(Long binariesItem) { + if (this.binaries == null) { + this.binaries = new ArrayList<>(); + } + this.binaries.add(binariesItem); + return this; + } + + /** + * Binary IDs to remove from the collection. Binary IDs not linked to the collection are ignored. + * @return binaries + */ + @javax.annotation.Nullable + public List getBinaries() { + return binaries; + } + + public void setBinaries(@javax.annotation.Nullable List binaries) { + this.binaries = binaries; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RemoveCollectionBinariesInputBody removeCollectionBinariesInputBody = (RemoveCollectionBinariesInputBody) o; + return Objects.equals(this.binaries, removeCollectionBinariesInputBody.binaries); + } + + @Override + public int hashCode() { + return Objects.hash(binaries); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RemoveCollectionBinariesInputBody {\n"); + sb.append(" binaries: ").append(toIndentedString(binaries)).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) { + return o == null ? "null" : 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 RemoveCollectionBinariesInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RemoveCollectionBinariesInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in RemoveCollectionBinariesInputBody is not found in the empty JSON string", RemoveCollectionBinariesInputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RemoveCollectionBinariesInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `RemoveCollectionBinariesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RemoveCollectionBinariesInputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.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() && !jsonObj.get("binaries").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.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 (!RemoveCollectionBinariesInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RemoveCollectionBinariesInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RemoveCollectionBinariesInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RemoveCollectionBinariesInputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RemoveCollectionBinariesInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RemoveCollectionBinariesInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of RemoveCollectionBinariesInputBody + * @throws IOException if the JSON string is invalid with respect to RemoveCollectionBinariesInputBody + */ + public static RemoveCollectionBinariesInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RemoveCollectionBinariesInputBody.class); + } + + /** + * Convert an instance of RemoveCollectionBinariesInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +