From d313c1e294bb2a748a0a67f7d3bf4febc3fd9a6b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 2 Oct 2026 07:10:33 +0000 Subject: [PATCH] Update SDK to version v4.69.0 - Generated from OpenAPI spec version v4.69.0 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 8 +- build.gradle | 4 +- build.sbt | 2 +- docs/AcceptTypeSuggestionsOutputBody.md | 2 +- docs/ErrorBody.md | 1 + docs/EventTypesApplied.md | 25 ++ docs/FunctionsAiDecompilationApi.md | 167 ++++++- docs/Status.md | 1 + docs/SuggestedTypeView.md | 5 +- docs/TypesAppliedEvent.md | 17 + pom.xml | 2 +- .../api/FunctionsAiDecompilationApi.java | 330 +++++++++++++- .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 2 + .../AcceptTypeSuggestionsOutputBody.java | 2 +- src/main/java/ai/reveng/model/ErrorBody.java | 2 + .../ai/reveng/model/EventTypesApplied.java | 422 ++++++++++++++++++ .../reveng/model/ServerSentEventsInner1.java | 58 ++- src/main/java/ai/reveng/model/Status.java | 2 + .../ai/reveng/model/SuggestedTypeView.java | 36 +- .../ai/reveng/model/TypesAppliedEvent.java | 393 ++++++++++++++++ 23 files changed, 1448 insertions(+), 39 deletions(-) create mode 100644 docs/EventTypesApplied.md create mode 100644 docs/TypesAppliedEvent.md create mode 100644 src/main/java/ai/reveng/model/EventTypesApplied.java create mode 100644 src/main/java/ai/reveng/model/TypesAppliedEvent.java diff --git a/.sdk-version b/.sdk-version index c1e14a1..a65f4e9 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v4.67.1 +v4.69.0 diff --git a/README.md b/README.md index 077876a..fd99d9c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 4.67.1 + 4.69.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:4.67.1" + implementation "ai.reveng:sdk:4.69.0" } ``` @@ -272,6 +272,8 @@ Class | Method | HTTP request | Description *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationRating**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationRating) | **GET** /v3/functions/{function_id}/ai-decompilation/rating | Get AI decompilation rating *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTokens**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTypeSuggestions**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestions) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Get AI decompilation type suggestions +*FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTypeSuggestionsStatus**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestionsStatus) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions/status | Get type suggestion workflow status +*FunctionsAiDecompilationApi* | [**v3RegenerateAiDecompilationTypeSuggestions**](docs/FunctionsAiDecompilationApi.md#v3RegenerateAiDecompilationTypeSuggestions) | **POST** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Regenerate AI decompilation type suggestions *FunctionsAiDecompilationApi* | [**v3UpsertAiDecompilationOverrides**](docs/FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides *FunctionsAiDecompilationApi* | [**v3UpsertAiDecompilationRating**](docs/FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationRating) | **PATCH** /v3/functions/{function_id}/ai-decompilation/rating | Upsert AI decompilation rating *FunctionsCoreApi* | [**addFunctionCallee**](docs/FunctionsCoreApi.md#addFunctionCallee) | **POST** /v3/functions/{function_id}/callees | Add a callee to a function @@ -641,6 +643,7 @@ Class | Method | HTTP request | Description - [EventTOOLCALLRESULT](docs/EventTOOLCALLRESULT.md) - [EventTOOLCALLSTART](docs/EventTOOLCALLSTART.md) - [EventTOOLCONFIRMATIONREQUIRED](docs/EventTOOLCONFIRMATIONREQUIRED.md) + - [EventTypesApplied](docs/EventTypesApplied.md) - [EventTypesSuggested](docs/EventTypesSuggested.md) - [EventWarning](docs/EventWarning.md) - [EvidenceEffect](docs/EvidenceEffect.md) @@ -1014,6 +1017,7 @@ Class | Method | HTTP request | Description - [TypeSuggestionsData](docs/TypeSuggestionsData.md) - [TypedefDataType](docs/TypedefDataType.md) - [TypedefDefinition](docs/TypedefDefinition.md) + - [TypesAppliedEvent](docs/TypesAppliedEvent.md) - [TypesSuggestedEvent](docs/TypesSuggestedEvent.md) - [UnionDataType](docs/UnionDataType.md) - [UnionDefinition](docs/UnionDefinition.md) diff --git a/build.gradle b/build.gradle index 5e399f0..6aa1375 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '4.67.1' +version = '4.69.0' @@ -174,7 +174,7 @@ mavenPublishing { // key, and signing without one fails the build. if (project.hasProperty("signingInMemoryKey")) signAllPublications() - coordinates("ai.reveng", "sdk", "4.67.1") + coordinates("ai.reveng", "sdk", "4.69.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index e3d9313..91a82af 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "4.67.1", + version := "4.69.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AcceptTypeSuggestionsOutputBody.md b/docs/AcceptTypeSuggestionsOutputBody.md index 3e2fa84..0df32ee 100644 --- a/docs/AcceptTypeSuggestionsOutputBody.md +++ b/docs/AcceptTypeSuggestionsOutputBody.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**accepted** | **List<AcceptedType>** | One entry per requested suggestion, in request order. | | +|**accepted** | **List<AcceptedType>** | One entry per requested suggestion that had a shape to store, in request order. | | |**dataTypes** | [**List<DataTypeEntry>**](DataTypeEntry.md) | The type each requested suggestion resolved to, plus every type minted to satisfy one, ordered by data_type_id. | | diff --git a/docs/ErrorBody.md b/docs/ErrorBody.md index fa08969..24217e0 100644 --- a/docs/ErrorBody.md +++ b/docs/ErrorBody.md @@ -55,6 +55,7 @@ | OIDC_DISCOVERY_FAILED | "OIDC_DISCOVERY_FAILED" | | PASSWORD_RESET_REQUIRED | "PASSWORD_RESET_REQUIRED" | | PAYMENT_REQUIRED | "PAYMENT_REQUIRED" | +| PRECONDITION_FAILED | "PRECONDITION_FAILED" | | REPORT_RENDER_FAILED | "REPORT_RENDER_FAILED" | | REQUEST_ENTITY_TOO_LARGE | "REQUEST_ENTITY_TOO_LARGE" | | RUN_ALREADY_ACTIVE | "RUN_ALREADY_ACTIVE" | diff --git a/docs/EventTypesApplied.md b/docs/EventTypesApplied.md new file mode 100644 index 0000000..8f7373e --- /dev/null +++ b/docs/EventTypesApplied.md @@ -0,0 +1,25 @@ + + +# EventTypesApplied + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **TypesAppliedEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| TYPES_APPLIED | "types_applied" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/FunctionsAiDecompilationApi.md b/docs/FunctionsAiDecompilationApi.md index 843ae7c..132e9fd 100644 --- a/docs/FunctionsAiDecompilationApi.md +++ b/docs/FunctionsAiDecompilationApi.md @@ -23,13 +23,15 @@ All URIs are relative to *https://api.reveng.ai* | [**v3GetAiDecompilationRating**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationRating) | **GET** /v3/functions/{function_id}/ai-decompilation/rating | Get AI decompilation rating | | [**v3GetAiDecompilationTokens**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides | | [**v3GetAiDecompilationTypeSuggestions**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestions) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Get AI decompilation type suggestions | +| [**v3GetAiDecompilationTypeSuggestionsStatus**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestionsStatus) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions/status | Get type suggestion workflow status | +| [**v3RegenerateAiDecompilationTypeSuggestions**](FunctionsAiDecompilationApi.md#v3RegenerateAiDecompilationTypeSuggestions) | **POST** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Regenerate AI decompilation type suggestions | | [**v3UpsertAiDecompilationOverrides**](FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides | | [**v3UpsertAiDecompilationRating**](FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationRating) | **PATCH** /v3/functions/{function_id}/ai-decompilation/rating | Upsert AI decompilation rating | # **createAiDecompilation** -> CreateAIDecompOutputBody createAiDecompilation(functionId, temperature, typeSuggestions) +> CreateAIDecompOutputBody createAiDecompilation(functionId, temperature, typeSuggestions, applyTypes) Start AI decompilation @@ -64,8 +66,9 @@ public class Example { Long functionId = 56L; // Long | Function ID Double temperature = -1D; // Double | LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. Boolean typeSuggestions = true; // Boolean | Ask the language model to name the suggested types and their members. Set to false to skip the model call; the statically derived layouts are still computed and stored. Cannot re-enable the pass when the server has it off. + Boolean applyTypes = true; // Boolean | Store the suggested types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. try { - CreateAIDecompOutputBody result = apiInstance.createAiDecompilation(functionId, temperature, typeSuggestions); + CreateAIDecompOutputBody result = apiInstance.createAiDecompilation(functionId, temperature, typeSuggestions, applyTypes); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FunctionsAiDecompilationApi#createAiDecompilation"); @@ -85,6 +88,7 @@ public class Example { | **functionId** | **Long**| Function ID | | | **temperature** | **Double**| LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. | [optional] [default to -1] | | **typeSuggestions** | **Boolean**| Ask the language model to name the suggested types and their members. Set to false to skip the model call; the statically derived layouts are still computed and stored. Cannot re-enable the pass when the server has it off. | [optional] [default to true] | +| **applyTypes** | **Boolean**| Store the suggested types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. | [optional] [default to true] | ### Return type @@ -1113,7 +1117,7 @@ public class Example { Accept AI decompilation type suggestions -Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error +Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed and a `TYPEDEF` where the suggestion is a name for a scalar. A suggestion nothing gave a shape to is left out, so `accepted` can be shorter than the keys requested. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error ### Example ```java @@ -1496,6 +1500,163 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3GetAiDecompilationTypeSuggestionsStatus** +> WorkflowProgress v3GetAiDecompilationTypeSuggestionsStatus(functionId) + +Get type suggestion workflow status + +Returns fine-grained progress of the type suggestion workflow. Reports PENDING while a decompilation is running, because its own type-naming pass produces the same suggestions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + +### 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.FunctionsAiDecompilationApi; + +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"); + + FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); + Long functionId = 56L; // Long | Function ID + try { + WorkflowProgress result = apiInstance.v3GetAiDecompilationTypeSuggestionsStatus(functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3GetAiDecompilationTypeSuggestionsStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **Long**| Function ID | | + +### Return type + +[**WorkflowProgress**](WorkflowProgress.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **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 | - | + + +# **v3RegenerateAiDecompilationTypeSuggestions** +> RegenerateOutputBody v3RegenerateAiDecompilationTypeSuggestions(functionId, applyTypes) + +Regenerate AI decompilation type suggestions + +Starts a new type suggestion workflow for the function, discarding the suggestions already stored. Requires a successful decompilation; it re-runs only the type-naming pass, so it costs no decompilation credit. The regenerated types are stored as data types of the analysis unless `apply_types=false`; types a previous run stored are not removed. Rejected while a decompilation is running: it runs the same pass itself once its output settles. Poll the type-suggestions status endpoint, which reports PENDING until then, and read the result from the type-suggestions endpoint. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + +### 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.FunctionsAiDecompilationApi; + +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"); + + FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); + Long functionId = 56L; // Long | Function ID + Boolean applyTypes = true; // Boolean | Store the regenerated types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. + try { + RegenerateOutputBody result = apiInstance.v3RegenerateAiDecompilationTypeSuggestions(functionId, applyTypes); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3RegenerateAiDecompilationTypeSuggestions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **Long**| Function ID | | +| **applyTypes** | **Boolean**| Store the regenerated types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. | [optional] [default to true] | + +### Return type + +[**RegenerateOutputBody**](RegenerateOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Accepted | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3UpsertAiDecompilationOverrides** > UpsertOverridesData v3UpsertAiDecompilationOverrides(functionId, upsertOverridesInputBody) diff --git a/docs/Status.md b/docs/Status.md index f77b1f6..448c3b0 100644 --- a/docs/Status.md +++ b/docs/Status.md @@ -55,6 +55,7 @@ | OIDC_DISCOVERY_FAILED | "OIDC_DISCOVERY_FAILED" | | PASSWORD_RESET_REQUIRED | "PASSWORD_RESET_REQUIRED" | | PAYMENT_REQUIRED | "PAYMENT_REQUIRED" | +| PRECONDITION_FAILED | "PRECONDITION_FAILED" | | REPORT_RENDER_FAILED | "REPORT_RENDER_FAILED" | | REQUEST_ENTITY_TOO_LARGE | "REQUEST_ENTITY_TOO_LARGE" | | RUN_ALREADY_ACTIVE | "RUN_ALREADY_ACTIVE" | diff --git a/docs/SuggestedTypeView.md b/docs/SuggestedTypeView.md index d83a047..d234164 100644 --- a/docs/SuggestedTypeView.md +++ b/docs/SuggestedTypeView.md @@ -7,10 +7,11 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**dataTypeId** | **Long** | Existing data type the members were accessed through. Null when nothing resolved to a row; never minted for a suggestion. | [optional] | +|**appliedDataTypeId** | **Long** | The type this suggestion became: a newly minted data type holding its name and members. Once set, the suggestion's entities resolve through this id rather than data_type_id. Null when it has not been applied, either because the pass is off or because nothing gave the suggestion a shape to store. | [optional] | +|**dataTypeId** | **Long** | The type this suggestion is about: the existing data type the members were accessed through. Never modified by applying a suggestion. Null when nothing resolved to a row, which is what makes the suggestion a proposal. | [optional] | |**holes** | **List<SuggestedHole>** | Gaps between consecutive placed members, in offset order. | | |**impliedSize** | **Long** | Highest byte_offset+byte_size across the members. A lower bound on the type's size, not its size. | [optional] | -|**key** | **String** | Identity of the suggestion: index:<data_type_id> where the access named a row, else token:<type_token>. | | +|**key** | **String** | Identity of the suggestion: index:<data_type_id> where the access named a row, type:<type_token> for a type with no observed members, else token:<type_token>. Do not infer data_type_id from the prefix: a type: key may carry one too. | | |**members** | **List<SuggestedMemberView>** | Members in offset order, unplaced ones last. | | |**name** | **String** | Name the type renders as: a database or frozen name where one exists, else the suggested one. | | |**typeToken** | **String** | Placeholder the type renders as, when it appears in this function's source. | [optional] | diff --git a/docs/TypesAppliedEvent.md b/docs/TypesAppliedEvent.md new file mode 100644 index 0000000..26e201c --- /dev/null +++ b/docs/TypesAppliedEvent.md @@ -0,0 +1,17 @@ + + +# TypesAppliedEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**seq** | **Integer** | | | +|**skipped** | **Integer** | | | +|**type** | **String** | | | +|**types** | **Integer** | | | + + + diff --git a/pom.xml b/pom.xml index 34c771e..43776dc 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 4.67.1 + 4.69.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java index cb37a2a..ee23157 100644 --- a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java +++ b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java @@ -96,6 +96,7 @@ public void setCustomBaseUrl(String customBaseUrl) { * @param functionId Function ID (required) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @param typeSuggestions Ask the language model to name the suggested types and their members. Set to false to skip the model call; the statically derived layouts are still computed and stored. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @param applyTypes Store the suggested types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -112,7 +113,7 @@ public void setCustomBaseUrl(String customBaseUrl) { 500 Internal Server Error - */ - public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, @javax.annotation.Nullable Boolean applyTypes, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -146,6 +147,10 @@ public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long fun localVarQueryParams.addAll(localVarApiClient.parameterToPair("type_suggestions", typeSuggestions)); } + if (applyTypes != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("apply_types", applyTypes)); + } + final String[] localVarAccepts = { "application/json" }; @@ -166,13 +171,13 @@ public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long fun } @SuppressWarnings("rawtypes") - private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, final ApiCallback _callback) throws ApiException { + private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, @javax.annotation.Nullable Boolean applyTypes, final ApiCallback _callback) throws ApiException { // verify the required parameter 'functionId' is set if (functionId == null) { throw new ApiException("Missing the required parameter 'functionId' when calling createAiDecompilation(Async)"); } - return createAiDecompilationCall(functionId, temperature, typeSuggestions, _callback); + return createAiDecompilationCall(functionId, temperature, typeSuggestions, applyTypes, _callback); } @@ -182,6 +187,7 @@ private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.N * @param functionId Function ID (required) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @param typeSuggestions Ask the language model to name the suggested types and their members. Set to false to skip the model call; the statically derived layouts are still computed and stored. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @param applyTypes Store the suggested types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) * @return CreateAIDecompOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -197,8 +203,8 @@ private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.N 500 Internal Server Error - */ - public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions) throws ApiException { - ApiResponse localVarResp = createAiDecompilationWithHttpInfo(functionId, temperature, typeSuggestions); + public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, @javax.annotation.Nullable Boolean applyTypes) throws ApiException { + ApiResponse localVarResp = createAiDecompilationWithHttpInfo(functionId, temperature, typeSuggestions, applyTypes); return localVarResp.getData(); } @@ -208,6 +214,7 @@ public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull * @param functionId Function ID (required) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @param typeSuggestions Ask the language model to name the suggested types and their members. Set to false to skip the model call; the statically derived layouts are still computed and stored. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @param applyTypes Store the suggested types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) * @return ApiResponse<CreateAIDecompOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -223,8 +230,8 @@ public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull 500 Internal Server Error - */ - public ApiResponse createAiDecompilationWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions) throws ApiException { - okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, temperature, typeSuggestions, null); + public ApiResponse createAiDecompilationWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, @javax.annotation.Nullable Boolean applyTypes) throws ApiException { + okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, temperature, typeSuggestions, applyTypes, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -235,6 +242,7 @@ public ApiResponse createAiDecompilationWithHttpInfo(@ * @param functionId Function ID (required) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @param typeSuggestions Ask the language model to name the suggested types and their members. Set to false to skip the model call; the statically derived layouts are still computed and stored. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @param applyTypes Store the suggested types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) * @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 @@ -251,9 +259,9 @@ public ApiResponse createAiDecompilationWithHttpInfo(@ 500 Internal Server Error - */ - public okhttp3.Call createAiDecompilationAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createAiDecompilationAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, @javax.annotation.Nullable Boolean typeSuggestions, @javax.annotation.Nullable Boolean applyTypes, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, temperature, typeSuggestions, _callback); + okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, temperature, typeSuggestions, applyTypes, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; @@ -2226,7 +2234,7 @@ private okhttp3.Call v3AcceptAiDecompilationTypeSuggestionsValidateBeforeCall(@j /** * Accept AI decompilation type suggestions - * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed and a `TYPEDEF` where the suggestion is a name for a scalar. A suggestion nothing gave a shape to is left out, so `accepted` can be shorter than the keys requested. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error * @param functionId Function ID (required) * @param acceptTypeSuggestionsInputBody (required) * @return AcceptTypeSuggestionsOutputBody @@ -2251,7 +2259,7 @@ public AcceptTypeSuggestionsOutputBody v3AcceptAiDecompilationTypeSuggestions(@j /** * Accept AI decompilation type suggestions - * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed and a `TYPEDEF` where the suggestion is a name for a scalar. A suggestion nothing gave a shape to is left out, so `accepted` can be shorter than the keys requested. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error * @param functionId Function ID (required) * @param acceptTypeSuggestionsInputBody (required) * @return ApiResponse<AcceptTypeSuggestionsOutputBody> @@ -2277,7 +2285,7 @@ public ApiResponse v3AcceptAiDecompilationTypeS /** * Accept AI decompilation type suggestions (asynchronously) - * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed and a `TYPEDEF` where the suggestion is a name for a scalar. A suggestion nothing gave a shape to is left out, so `accepted` can be shorter than the keys requested. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error * @param functionId Function ID (required) * @param acceptTypeSuggestionsInputBody (required) * @param _callback The callback to be executed when the API call finishes @@ -2875,6 +2883,304 @@ public okhttp3.Call v3GetAiDecompilationTypeSuggestionsAsync(@javax.annotation.N localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetAiDecompilationTypeSuggestionsStatus + * @param functionId Function ID (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 v3GetAiDecompilationTypeSuggestionsStatusCall(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/type-suggestions/status" + .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3GetAiDecompilationTypeSuggestionsStatusValidateBeforeCall(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException("Missing the required parameter 'functionId' when calling v3GetAiDecompilationTypeSuggestionsStatus(Async)"); + } + + return v3GetAiDecompilationTypeSuggestionsStatusCall(functionId, _callback); + + } + + /** + * Get type suggestion workflow status + * Returns fine-grained progress of the type suggestion workflow. Reports PENDING while a decompilation is running, because its own type-naming pass produces the same suggestions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param functionId Function ID (required) + * @return WorkflowProgress + * @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 WorkflowProgress v3GetAiDecompilationTypeSuggestionsStatus(@javax.annotation.Nonnull Long functionId) throws ApiException { + ApiResponse localVarResp = v3GetAiDecompilationTypeSuggestionsStatusWithHttpInfo(functionId); + return localVarResp.getData(); + } + + /** + * Get type suggestion workflow status + * Returns fine-grained progress of the type suggestion workflow. Reports PENDING while a decompilation is running, because its own type-naming pass produces the same suggestions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param functionId Function ID (required) + * @return ApiResponse<WorkflowProgress> + * @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 v3GetAiDecompilationTypeSuggestionsStatusWithHttpInfo(@javax.annotation.Nonnull Long functionId) throws ApiException { + okhttp3.Call localVarCall = v3GetAiDecompilationTypeSuggestionsStatusValidateBeforeCall(functionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get type suggestion workflow status (asynchronously) + * Returns fine-grained progress of the type suggestion workflow. Reports PENDING while a decompilation is running, because its own type-naming pass produces the same suggestions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param functionId Function ID (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 v3GetAiDecompilationTypeSuggestionsStatusAsync(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAiDecompilationTypeSuggestionsStatusValidateBeforeCall(functionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3RegenerateAiDecompilationTypeSuggestions + * @param functionId Function ID (required) + * @param applyTypes Store the regenerated types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RegenerateAiDecompilationTypeSuggestionsCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean applyTypes, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/type-suggestions" + .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (applyTypes != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("apply_types", applyTypes)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3RegenerateAiDecompilationTypeSuggestionsValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean applyTypes, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException("Missing the required parameter 'functionId' when calling v3RegenerateAiDecompilationTypeSuggestions(Async)"); + } + + return v3RegenerateAiDecompilationTypeSuggestionsCall(functionId, applyTypes, _callback); + + } + + /** + * Regenerate AI decompilation type suggestions + * Starts a new type suggestion workflow for the function, discarding the suggestions already stored. Requires a successful decompilation; it re-runs only the type-naming pass, so it costs no decompilation credit. The regenerated types are stored as data types of the analysis unless `apply_types=false`; types a previous run stored are not removed. Rejected while a decompilation is running: it runs the same pass itself once its output settles. Poll the type-suggestions status endpoint, which reports PENDING until then, and read the result from the type-suggestions endpoint. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param applyTypes Store the regenerated types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @return RegenerateOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public RegenerateOutputBody v3RegenerateAiDecompilationTypeSuggestions(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean applyTypes) throws ApiException { + ApiResponse localVarResp = v3RegenerateAiDecompilationTypeSuggestionsWithHttpInfo(functionId, applyTypes); + return localVarResp.getData(); + } + + /** + * Regenerate AI decompilation type suggestions + * Starts a new type suggestion workflow for the function, discarding the suggestions already stored. Requires a successful decompilation; it re-runs only the type-naming pass, so it costs no decompilation credit. The regenerated types are stored as data types of the analysis unless `apply_types=false`; types a previous run stored are not removed. Rejected while a decompilation is running: it runs the same pass itself once its output settles. Poll the type-suggestions status endpoint, which reports PENDING until then, and read the result from the type-suggestions endpoint. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param applyTypes Store the regenerated types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @return ApiResponse<RegenerateOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3RegenerateAiDecompilationTypeSuggestionsWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean applyTypes) throws ApiException { + okhttp3.Call localVarCall = v3RegenerateAiDecompilationTypeSuggestionsValidateBeforeCall(functionId, applyTypes, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Regenerate AI decompilation type suggestions (asynchronously) + * Starts a new type suggestion workflow for the function, discarding the suggestions already stored. Requires a successful decompilation; it re-runs only the type-naming pass, so it costs no decompilation credit. The regenerated types are stored as data types of the analysis unless `apply_types=false`; types a previous run stored are not removed. Rejected while a decompilation is running: it runs the same pass itself once its output settles. Poll the type-suggestions status endpoint, which reports PENDING until then, and read the result from the type-suggestions endpoint. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param applyTypes Store the regenerated types as data types of this function's analysis, with a source_type of AI_DECOMP. Set to false to leave them as suggestions only. Cannot re-enable the pass when the server has it off. (optional, default to true) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RegenerateAiDecompilationTypeSuggestionsAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean applyTypes, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3RegenerateAiDecompilationTypeSuggestionsValidateBeforeCall(functionId, applyTypes, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3UpsertAiDecompilationOverrides * @param functionId Function ID (required) diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 194614e..aaf2755 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/4.67.1/java"); + setUserAgent("OpenAPI-Generator/4.69.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 dbe27a0..f8eab0e 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 = "4.67.1"; + public static final String VERSION = "4.69.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 63cac34..7aaf86d 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -483,6 +483,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTOOLCALLRESULT.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTOOLCALLSTART.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTOOLCONFIRMATIONREQUIRED.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTypesApplied.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTypesSuggested.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventWarning.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EvidenceInner.CustomTypeAdapterFactory()); @@ -840,6 +841,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypeSuggestionsData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypedefDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypedefDefinition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypesAppliedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypesSuggestedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UnionDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UnionDefinition.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AcceptTypeSuggestionsOutputBody.java b/src/main/java/ai/reveng/model/AcceptTypeSuggestionsOutputBody.java index 3e72a8c..81dd5bb 100644 --- a/src/main/java/ai/reveng/model/AcceptTypeSuggestionsOutputBody.java +++ b/src/main/java/ai/reveng/model/AcceptTypeSuggestionsOutputBody.java @@ -80,7 +80,7 @@ public AcceptTypeSuggestionsOutputBody addAcceptedItem(AcceptedType acceptedItem } /** - * One entry per requested suggestion, in request order. + * One entry per requested suggestion that had a shape to store, in request order. * @return accepted */ @javax.annotation.Nullable diff --git a/src/main/java/ai/reveng/model/ErrorBody.java b/src/main/java/ai/reveng/model/ErrorBody.java index c15523c..17f7bd2 100644 --- a/src/main/java/ai/reveng/model/ErrorBody.java +++ b/src/main/java/ai/reveng/model/ErrorBody.java @@ -126,6 +126,8 @@ public enum CodeEnum { PAYMENT_REQUIRED("PAYMENT_REQUIRED"), + PRECONDITION_FAILED("PRECONDITION_FAILED"), + REPORT_RENDER_FAILED("REPORT_RENDER_FAILED"), REQUEST_ENTITY_TOO_LARGE("REQUEST_ENTITY_TOO_LARGE"), diff --git a/src/main/java/ai/reveng/model/EventTypesApplied.java b/src/main/java/ai/reveng/model/EventTypesApplied.java new file mode 100644 index 0000000..f56e8b7 --- /dev/null +++ b/src/main/java/ai/reveng/model/EventTypesApplied.java @@ -0,0 +1,422 @@ +/* + * 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 ai.reveng.model.TypesAppliedEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * EventTypesApplied + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventTypesApplied { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private TypesAppliedEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + TYPES_APPLIED("types_applied"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + EventEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static EventEnum fromValue(String value) { + for (EventEnum b : EventEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EventEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public EventEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EventEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EventEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_EVENT = "event"; + @SerializedName(SERIALIZED_NAME_EVENT) + @javax.annotation.Nonnull + private EventEnum event; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Integer id; + + public static final String SERIALIZED_NAME_RETRY = "retry"; + @SerializedName(SERIALIZED_NAME_RETRY) + @javax.annotation.Nullable + private Integer retry; + + public EventTypesApplied() { + } + + public EventTypesApplied data(@javax.annotation.Nonnull TypesAppliedEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public TypesAppliedEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull TypesAppliedEvent data) { + this.data = data; + } + + + public EventTypesApplied event(@javax.annotation.Nonnull EventEnum event) { + this.event = event; + return this; + } + + /** + * The event name. + * @return event + */ + @javax.annotation.Nonnull + public EventEnum getEvent() { + return event; + } + + public void setEvent(@javax.annotation.Nonnull EventEnum event) { + this.event = event; + } + + + public EventTypesApplied id(@javax.annotation.Nullable Integer id) { + this.id = id; + return this; + } + + /** + * The event ID. + * @return id + */ + @javax.annotation.Nullable + public Integer getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Integer id) { + this.id = id; + } + + + public EventTypesApplied retry(@javax.annotation.Nullable Integer retry) { + this.retry = retry; + return this; + } + + /** + * The retry time in milliseconds. + * @return retry + */ + @javax.annotation.Nullable + public Integer getRetry() { + return retry; + } + + public void setRetry(@javax.annotation.Nullable Integer retry) { + this.retry = retry; + } + + /** + * 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 EventTypesApplied instance itself + */ + public EventTypesApplied 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; + } + EventTypesApplied eventTypesApplied = (EventTypesApplied) o; + return Objects.equals(this.data, eventTypesApplied.data) && + Objects.equals(this.event, eventTypesApplied.event) && + Objects.equals(this.id, eventTypesApplied.id) && + Objects.equals(this.retry, eventTypesApplied.retry)&& + Objects.equals(this.additionalProperties, eventTypesApplied.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventTypesApplied {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" retry: ").append(toIndentedString(retry)).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) { + 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("data", "event", "id", "retry")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data", "event")); + } + + /** + * 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 EventTypesApplied + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventTypesApplied.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 EventTypesApplied is not found in the empty JSON string", EventTypesApplied.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventTypesApplied.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(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `event` to be a primitive type in the JSON string but got `%s`", jsonObj.get("event").toString())); + } + // validate the required field `event` + EventEnum.validateJsonElement(jsonObj.get("event")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EventTypesApplied.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventTypesApplied' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventTypesApplied.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventTypesApplied 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 EventTypesApplied read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventTypesApplied 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(java.util.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 EventTypesApplied given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventTypesApplied + * @throws IOException if the JSON string is invalid with respect to EventTypesApplied + */ + public static EventTypesApplied fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventTypesApplied.class); + } + + /** + * Convert an instance of EventTypesApplied to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ServerSentEventsInner1.java b/src/main/java/ai/reveng/model/ServerSentEventsInner1.java index 2945a35..55ad983 100644 --- a/src/main/java/ai/reveng/model/ServerSentEventsInner1.java +++ b/src/main/java/ai/reveng/model/ServerSentEventsInner1.java @@ -22,6 +22,7 @@ import ai.reveng.model.EventRenameApplied; import ai.reveng.model.EventSourceDelta; import ai.reveng.model.EventSourceReset; +import ai.reveng.model.EventTypesApplied; import ai.reveng.model.EventTypesSuggested; import ai.reveng.model.EventWarning; import ai.reveng.model.WarningEvent; @@ -89,6 +90,7 @@ public TypeAdapter create(Gson gson, TypeToken type) { final TypeAdapter adapterEventRenameApplied = gson.getDelegateAdapter(this, TypeToken.get(EventRenameApplied.class)); final TypeAdapter adapterEventSourceDelta = gson.getDelegateAdapter(this, TypeToken.get(EventSourceDelta.class)); final TypeAdapter adapterEventSourceReset = gson.getDelegateAdapter(this, TypeToken.get(EventSourceReset.class)); + final TypeAdapter adapterEventTypesApplied = gson.getDelegateAdapter(this, TypeToken.get(EventTypesApplied.class)); final TypeAdapter adapterEventTypesSuggested = gson.getDelegateAdapter(this, TypeToken.get(EventTypesSuggested.class)); final TypeAdapter adapterEventWarning = gson.getDelegateAdapter(this, TypeToken.get(EventWarning.class)); @@ -154,6 +156,12 @@ public void write(JsonWriter out, ServerSentEventsInner1 value) throws IOExcepti elementAdapter.write(out, element); return; } + // check if the actual instance is of the type `EventTypesApplied` + if (value.getActualInstance() instanceof EventTypesApplied) { + JsonElement element = adapterEventTypesApplied.toJsonTree((EventTypesApplied)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } // check if the actual instance is of the type `EventTypesSuggested` if (value.getActualInstance() instanceof EventTypesSuggested) { JsonElement element = adapterEventTypesSuggested.toJsonTree((EventTypesSuggested)value.getActualInstance()); @@ -166,7 +174,7 @@ public void write(JsonWriter out, ServerSentEventsInner1 value) throws IOExcepti elementAdapter.write(out, element); return; } - throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesSuggested, EventWarning"); + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesApplied, EventTypesSuggested, EventWarning"); } @Override @@ -286,6 +294,18 @@ public ServerSentEventsInner1 read(JsonReader in) throws IOException { errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventSourceReset failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'EventSourceReset'", e); } + // deserialize EventTypesApplied + try { + // validate the JSON object to see if any exception is thrown + EventTypesApplied.validateJsonElement(jsonElement); + actualAdapter = adapterEventTypesApplied; + match++; + log.log(Level.FINER, "Input data matches schema 'EventTypesApplied'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventTypesApplied failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventTypesApplied'", e); + } // deserialize EventTypesSuggested try { // validate the JSON object to see if any exception is thrown @@ -345,6 +365,7 @@ public ServerSentEventsInner1(Object o) { schemas.put("EventRenameApplied", EventRenameApplied.class); schemas.put("EventSourceDelta", EventSourceDelta.class); schemas.put("EventSourceReset", EventSourceReset.class); + schemas.put("EventTypesApplied", EventTypesApplied.class); schemas.put("EventTypesSuggested", EventTypesSuggested.class); schemas.put("EventWarning", EventWarning.class); } @@ -357,7 +378,7 @@ public Map> getSchemas() { /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: - * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesSuggested, EventWarning + * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesApplied, EventTypesSuggested, EventWarning * * It could be an instance of the 'oneOf' schemas. */ @@ -408,6 +429,11 @@ public void setActualInstance(Object instance) { return; } + if (instance instanceof EventTypesApplied) { + super.setActualInstance(instance); + return; + } + if (instance instanceof EventTypesSuggested) { super.setActualInstance(instance); return; @@ -418,14 +444,14 @@ public void setActualInstance(Object instance) { return; } - throw new RuntimeException("Invalid instance type. Must be EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesSuggested, EventWarning"); + throw new RuntimeException("Invalid instance type. Must be EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesApplied, EventTypesSuggested, EventWarning"); } /** * Get the actual instance, which can be the following: - * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesSuggested, EventWarning + * EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesApplied, EventTypesSuggested, EventWarning * - * @return The actual instance (EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesSuggested, EventWarning) + * @return The actual instance (EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesApplied, EventTypesSuggested, EventWarning) */ @SuppressWarnings("unchecked") @Override @@ -541,6 +567,18 @@ public EventSourceReset getEventSourceReset() throws ClassCastException { return (EventSourceReset)super.getActualInstance(); } + /** + * Get the actual instance of `EventTypesApplied`. If the actual instance is not `EventTypesApplied`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventTypesApplied` + * @throws ClassCastException if the instance is not `EventTypesApplied` + */ + @SuppressWarnings("unchecked") + public EventTypesApplied getEventTypesApplied() throws ClassCastException { + return (EventTypesApplied)super.getActualInstance(); + } + /** * Get the actual instance of `EventTypesSuggested`. If the actual instance is not `EventTypesSuggested`, * the ClassCastException will be thrown. @@ -647,6 +685,14 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventSourceReset failed with `%s`.", e.getMessage())); // continue to the next one } + // validate the json string with EventTypesApplied + try { + EventTypesApplied.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EventTypesApplied failed with `%s`.", e.getMessage())); + // continue to the next one + } // validate the json string with EventTypesSuggested try { EventTypesSuggested.validateJsonElement(jsonElement); @@ -664,7 +710,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti // continue to the next one } if (validCount != 1) { - throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for ServerSentEventsInner1 with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesSuggested, EventWarning. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for ServerSentEventsInner1 with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDecompFailed, EventDecompFinished, EventNamesFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventTypesApplied, EventTypesSuggested, EventWarning. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } diff --git a/src/main/java/ai/reveng/model/Status.java b/src/main/java/ai/reveng/model/Status.java index a886e17..2b0ed88 100644 --- a/src/main/java/ai/reveng/model/Status.java +++ b/src/main/java/ai/reveng/model/Status.java @@ -126,6 +126,8 @@ public enum CodeEnum { PAYMENT_REQUIRED("PAYMENT_REQUIRED"), + PRECONDITION_FAILED("PRECONDITION_FAILED"), + REPORT_RENDER_FAILED("REPORT_RENDER_FAILED"), REQUEST_ENTITY_TOO_LARGE("REQUEST_ENTITY_TOO_LARGE"), diff --git a/src/main/java/ai/reveng/model/SuggestedTypeView.java b/src/main/java/ai/reveng/model/SuggestedTypeView.java index 1412abe..9dc9866 100644 --- a/src/main/java/ai/reveng/model/SuggestedTypeView.java +++ b/src/main/java/ai/reveng/model/SuggestedTypeView.java @@ -53,6 +53,11 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SuggestedTypeView { + public static final String SERIALIZED_NAME_APPLIED_DATA_TYPE_ID = "applied_data_type_id"; + @SerializedName(SERIALIZED_NAME_APPLIED_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long appliedDataTypeId; + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) @javax.annotation.Nullable @@ -96,13 +101,32 @@ public class SuggestedTypeView { public SuggestedTypeView() { } + public SuggestedTypeView appliedDataTypeId(@javax.annotation.Nullable Long appliedDataTypeId) { + this.appliedDataTypeId = appliedDataTypeId; + return this; + } + + /** + * The type this suggestion became: a newly minted data type holding its name and members. Once set, the suggestion's entities resolve through this id rather than data_type_id. Null when it has not been applied, either because the pass is off or because nothing gave the suggestion a shape to store. + * @return appliedDataTypeId + */ + @javax.annotation.Nullable + public Long getAppliedDataTypeId() { + return appliedDataTypeId; + } + + public void setAppliedDataTypeId(@javax.annotation.Nullable Long appliedDataTypeId) { + this.appliedDataTypeId = appliedDataTypeId; + } + + public SuggestedTypeView dataTypeId(@javax.annotation.Nullable Long dataTypeId) { this.dataTypeId = dataTypeId; return this; } /** - * Existing data type the members were accessed through. Null when nothing resolved to a row; never minted for a suggestion. + * The type this suggestion is about: the existing data type the members were accessed through. Never modified by applying a suggestion. Null when nothing resolved to a row, which is what makes the suggestion a proposal. * @return dataTypeId */ @javax.annotation.Nullable @@ -167,7 +191,7 @@ public SuggestedTypeView key(@javax.annotation.Nonnull String key) { } /** - * Identity of the suggestion: index:<data_type_id> where the access named a row, else token:<type_token>. + * Identity of the suggestion: index:<data_type_id> where the access named a row, type:<type_token> for a type with no observed members, else token:<type_token>. Do not infer data_type_id from the prefix: a type: key may carry one too. * @return key */ @javax.annotation.Nonnull @@ -318,7 +342,8 @@ public boolean equals(Object o) { return false; } SuggestedTypeView suggestedTypeView = (SuggestedTypeView) o; - return Objects.equals(this.dataTypeId, suggestedTypeView.dataTypeId) && + return Objects.equals(this.appliedDataTypeId, suggestedTypeView.appliedDataTypeId) && + Objects.equals(this.dataTypeId, suggestedTypeView.dataTypeId) && Objects.equals(this.holes, suggestedTypeView.holes) && Objects.equals(this.impliedSize, suggestedTypeView.impliedSize) && Objects.equals(this.key, suggestedTypeView.key) && @@ -331,13 +356,14 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(dataTypeId, holes, impliedSize, key, members, name, typeToken, underlyingType, additionalProperties); + return Objects.hash(appliedDataTypeId, dataTypeId, holes, impliedSize, key, members, name, typeToken, underlyingType, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class SuggestedTypeView {\n"); + sb.append(" appliedDataTypeId: ").append(toIndentedString(appliedDataTypeId)).append("\n"); sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); sb.append(" holes: ").append(toIndentedString(holes)).append("\n"); sb.append(" impliedSize: ").append(toIndentedString(impliedSize)).append("\n"); @@ -365,7 +391,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("data_type_id", "holes", "implied_size", "key", "members", "name", "type_token", "underlying_type")); + openapiFields = new HashSet(Arrays.asList("applied_data_type_id", "data_type_id", "holes", "implied_size", "key", "members", "name", "type_token", "underlying_type")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("holes", "key", "members", "name")); diff --git a/src/main/java/ai/reveng/model/TypesAppliedEvent.java b/src/main/java/ai/reveng/model/TypesAppliedEvent.java new file mode 100644 index 0000000..28d18b2 --- /dev/null +++ b/src/main/java/ai/reveng/model/TypesAppliedEvent.java @@ -0,0 +1,393 @@ +/* + * 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.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * TypesAppliedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TypesAppliedEvent { + public static final String SERIALIZED_NAME_ATTEMPT = "attempt"; + @SerializedName(SERIALIZED_NAME_ATTEMPT) + @javax.annotation.Nonnull + private Integer attempt; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nonnull + private Integer seq; + + public static final String SERIALIZED_NAME_SKIPPED = "skipped"; + @SerializedName(SERIALIZED_NAME_SKIPPED) + @javax.annotation.Nonnull + private Integer skipped; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_TYPES = "types"; + @SerializedName(SERIALIZED_NAME_TYPES) + @javax.annotation.Nonnull + private Integer types; + + public TypesAppliedEvent() { + } + + public TypesAppliedEvent attempt(@javax.annotation.Nonnull Integer attempt) { + this.attempt = attempt; + return this; + } + + /** + * Get attempt + * @return attempt + */ + @javax.annotation.Nonnull + public Integer getAttempt() { + return attempt; + } + + public void setAttempt(@javax.annotation.Nonnull Integer attempt) { + this.attempt = attempt; + } + + + public TypesAppliedEvent seq(@javax.annotation.Nonnull Integer seq) { + this.seq = seq; + return this; + } + + /** + * Get seq + * @return seq + */ + @javax.annotation.Nonnull + public Integer getSeq() { + return seq; + } + + public void setSeq(@javax.annotation.Nonnull Integer seq) { + this.seq = seq; + } + + + public TypesAppliedEvent skipped(@javax.annotation.Nonnull Integer skipped) { + this.skipped = skipped; + return this; + } + + /** + * Get skipped + * @return skipped + */ + @javax.annotation.Nonnull + public Integer getSkipped() { + return skipped; + } + + public void setSkipped(@javax.annotation.Nonnull Integer skipped) { + this.skipped = skipped; + } + + + public TypesAppliedEvent type(@javax.annotation.Nonnull String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + public void setType(@javax.annotation.Nonnull String type) { + this.type = type; + } + + + public TypesAppliedEvent types(@javax.annotation.Nonnull Integer types) { + this.types = types; + return this; + } + + /** + * Get types + * @return types + */ + @javax.annotation.Nonnull + public Integer getTypes() { + return types; + } + + public void setTypes(@javax.annotation.Nonnull Integer types) { + this.types = types; + } + + /** + * 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 TypesAppliedEvent instance itself + */ + public TypesAppliedEvent 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; + } + TypesAppliedEvent typesAppliedEvent = (TypesAppliedEvent) o; + return Objects.equals(this.attempt, typesAppliedEvent.attempt) && + Objects.equals(this.seq, typesAppliedEvent.seq) && + Objects.equals(this.skipped, typesAppliedEvent.skipped) && + Objects.equals(this.type, typesAppliedEvent.type) && + Objects.equals(this.types, typesAppliedEvent.types)&& + Objects.equals(this.additionalProperties, typesAppliedEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, seq, skipped, type, types, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypesAppliedEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" skipped: ").append(toIndentedString(skipped)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" types: ").append(toIndentedString(types)).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) { + 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("attempt", "seq", "skipped", "type", "types")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "seq", "skipped", "type", "types")); + } + + /** + * 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 TypesAppliedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypesAppliedEvent.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 TypesAppliedEvent is not found in the empty JSON string", TypesAppliedEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TypesAppliedEvent.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(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypesAppliedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypesAppliedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypesAppliedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypesAppliedEvent 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 TypesAppliedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TypesAppliedEvent 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(java.util.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 TypesAppliedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypesAppliedEvent + * @throws IOException if the JSON string is invalid with respect to TypesAppliedEvent + */ + public static TypesAppliedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypesAppliedEvent.class); + } + + /** + * Convert an instance of TypesAppliedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +