From ee1d58a8bd12d001d983524065cf7cd9c42767ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 22 May 2026 08:06:18 +0000 Subject: [PATCH] Update SDK to version v3.85.0 - Generated from OpenAPI spec version v3.85.0 - Auto-generated by GitHub Actions --- README.md | 22 + docs/AttemptFailedEvent.md | 16 + docs/AttemptStartedEvent.md | 15 + docs/DebugPromptEvent.md | 17 + docs/DecompFailedEvent.md | 17 + docs/DecompFinishedEvent.md | 15 + docs/EventAttemptFailed.md | 25 + docs/EventAttemptStarted.md | 25 + docs/EventDebugPrompt.md | 25 + docs/EventDecompFailed.md | 25 + docs/EventDecompFinished.md | 25 + docs/EventProse.md | 25 + docs/EventRenameApplied.md | 25 + docs/EventSourceDelta.md | 25 + docs/EventSourceReset.md | 25 + docs/EventWarning.md | 25 + docs/FunctionsAiDecompilationApi.md | 71 ++ docs/ProseEvent.md | 16 + docs/RenameAppliedEvent.md | 18 + docs/SourceDeltaEvent.md | 16 + docs/SourceResetEvent.md | 15 + docs/StreamAiDecompilation200ResponseInner.md | 25 + docs/WarningEvent.md | 18 + .../api/FunctionsAiDecompilationApi.java | 133 ++++ src/main/java/ai/reveng/invoker/JSON.java | 21 + .../ai/reveng/model/AttemptFailedEvent.java | 375 +++++++++++ .../ai/reveng/model/AttemptStartedEvent.java | 346 ++++++++++ .../ai/reveng/model/DebugPromptEvent.java | 404 +++++++++++ .../ai/reveng/model/DecompFailedEvent.java | 404 +++++++++++ .../ai/reveng/model/DecompFinishedEvent.java | 346 ++++++++++ .../ai/reveng/model/EventAttemptFailed.java | 427 ++++++++++++ .../ai/reveng/model/EventAttemptStarted.java | 427 ++++++++++++ .../ai/reveng/model/EventDebugPrompt.java | 427 ++++++++++++ .../ai/reveng/model/EventDecompFailed.java | 427 ++++++++++++ .../ai/reveng/model/EventDecompFinished.java | 427 ++++++++++++ src/main/java/ai/reveng/model/EventProse.java | 427 ++++++++++++ .../ai/reveng/model/EventRenameApplied.java | 427 ++++++++++++ .../ai/reveng/model/EventSourceDelta.java | 427 ++++++++++++ .../ai/reveng/model/EventSourceReset.java | 427 ++++++++++++ .../java/ai/reveng/model/EventWarning.java | 427 ++++++++++++ src/main/java/ai/reveng/model/ProseEvent.java | 375 +++++++++++ .../ai/reveng/model/RenameAppliedEvent.java | 433 ++++++++++++ .../ai/reveng/model/SourceDeltaEvent.java | 375 +++++++++++ .../ai/reveng/model/SourceResetEvent.java | 346 ++++++++++ ...StreamAiDecompilation200ResponseInner.java | 637 ++++++++++++++++++ .../java/ai/reveng/model/WarningEvent.java | 456 +++++++++++++ 46 files changed, 9452 insertions(+) create mode 100644 docs/AttemptFailedEvent.md create mode 100644 docs/AttemptStartedEvent.md create mode 100644 docs/DebugPromptEvent.md create mode 100644 docs/DecompFailedEvent.md create mode 100644 docs/DecompFinishedEvent.md create mode 100644 docs/EventAttemptFailed.md create mode 100644 docs/EventAttemptStarted.md create mode 100644 docs/EventDebugPrompt.md create mode 100644 docs/EventDecompFailed.md create mode 100644 docs/EventDecompFinished.md create mode 100644 docs/EventProse.md create mode 100644 docs/EventRenameApplied.md create mode 100644 docs/EventSourceDelta.md create mode 100644 docs/EventSourceReset.md create mode 100644 docs/EventWarning.md create mode 100644 docs/ProseEvent.md create mode 100644 docs/RenameAppliedEvent.md create mode 100644 docs/SourceDeltaEvent.md create mode 100644 docs/SourceResetEvent.md create mode 100644 docs/StreamAiDecompilation200ResponseInner.md create mode 100644 docs/WarningEvent.md create mode 100644 src/main/java/ai/reveng/model/AttemptFailedEvent.java create mode 100644 src/main/java/ai/reveng/model/AttemptStartedEvent.java create mode 100644 src/main/java/ai/reveng/model/DebugPromptEvent.java create mode 100644 src/main/java/ai/reveng/model/DecompFailedEvent.java create mode 100644 src/main/java/ai/reveng/model/DecompFinishedEvent.java create mode 100644 src/main/java/ai/reveng/model/EventAttemptFailed.java create mode 100644 src/main/java/ai/reveng/model/EventAttemptStarted.java create mode 100644 src/main/java/ai/reveng/model/EventDebugPrompt.java create mode 100644 src/main/java/ai/reveng/model/EventDecompFailed.java create mode 100644 src/main/java/ai/reveng/model/EventDecompFinished.java create mode 100644 src/main/java/ai/reveng/model/EventProse.java create mode 100644 src/main/java/ai/reveng/model/EventRenameApplied.java create mode 100644 src/main/java/ai/reveng/model/EventSourceDelta.java create mode 100644 src/main/java/ai/reveng/model/EventSourceReset.java create mode 100644 src/main/java/ai/reveng/model/EventWarning.java create mode 100644 src/main/java/ai/reveng/model/ProseEvent.java create mode 100644 src/main/java/ai/reveng/model/RenameAppliedEvent.java create mode 100644 src/main/java/ai/reveng/model/SourceDeltaEvent.java create mode 100644 src/main/java/ai/reveng/model/SourceResetEvent.java create mode 100644 src/main/java/ai/reveng/model/StreamAiDecompilation200ResponseInner.java create mode 100644 src/main/java/ai/reveng/model/WarningEvent.java diff --git a/README.md b/README.md index 12c89194..c30ef5b5 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,7 @@ Class | Method | HTTP request | Description *FunctionsAiDecompilationApi* | [**patchAiDecompilationInlineComment**](docs/FunctionsAiDecompilationApi.md#patchAiDecompilationInlineComment) | **PATCH** /v3/functions/{function_id}/ai-decompilation/inline-comments | Update a single inline comment *FunctionsAiDecompilationApi* | [**regenerateAiDecompilationInlineComments**](docs/FunctionsAiDecompilationApi.md#regenerateAiDecompilationInlineComments) | **POST** /v3/functions/{function_id}/ai-decompilation/inline-comments | Regenerate AI decompilation inline comments *FunctionsAiDecompilationApi* | [**regenerateAiDecompilationSummary**](docs/FunctionsAiDecompilationApi.md#regenerateAiDecompilationSummary) | **POST** /v3/functions/{function_id}/ai-decompilation/summary | Regenerate AI decompilation summary +*FunctionsAiDecompilationApi* | [**streamAiDecompilation**](docs/FunctionsAiDecompilationApi.md#streamAiDecompilation) | **GET** /v3/functions/{function_id}/ai-decompilation/events | Stream live AI decompilation output (SSE) *FunctionsAiDecompilationApi* | [**updateAiDecompilationComment**](docs/FunctionsAiDecompilationApi.md#updateAiDecompilationComment) | **PATCH** /v2/functions/{function_id}/ai-decompilation/comments/{comment_id} | Update a comment *FunctionsAiDecompilationApi* | [**upsertAiDecompilationOverrides**](docs/FunctionsAiDecompilationApi.md#upsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides *FunctionsAiDecompilationApi* | [**upsertAiDecompilationRating**](docs/FunctionsAiDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation @@ -246,6 +247,8 @@ Class | Method | HTTP request | Description - [AppApiRestV2FunctionsTypesFunction](docs/AppApiRestV2FunctionsTypesFunction.md) - [AppApiRestV2InfoTypesCapability](docs/AppApiRestV2InfoTypesCapability.md) - [Argument](docs/Argument.md) + - [AttemptFailedEvent](docs/AttemptFailedEvent.md) + - [AttemptStartedEvent](docs/AttemptStartedEvent.md) - [AutoRunAgents](docs/AutoRunAgents.md) - [AutoUnstripRequest](docs/AutoUnstripRequest.md) - [AutoUnstripResponse](docs/AutoUnstripResponse.md) @@ -366,6 +369,9 @@ Class | Method | HTTP request | Description - [CreateAIDecompOutputBody](docs/CreateAIDecompOutputBody.md) - [CreateConversationRequest](docs/CreateConversationRequest.md) - [Created](docs/Created.md) + - [DebugPromptEvent](docs/DebugPromptEvent.md) + - [DecompFailedEvent](docs/DecompFailedEvent.md) + - [DecompFinishedEvent](docs/DecompFinishedEvent.md) - [DecompilationCommentContext](docs/DecompilationCommentContext.md) - [DecompilationData](docs/DecompilationData.md) - [DieMatch](docs/DieMatch.md) @@ -386,13 +392,22 @@ Class | Method | HTTP request | Description - [ErrorBody](docs/ErrorBody.md) - [ErrorModel](docs/ErrorModel.md) - [Event](docs/Event.md) + - [EventAttemptFailed](docs/EventAttemptFailed.md) + - [EventAttemptStarted](docs/EventAttemptStarted.md) - [EventCONTEXTCOMPACTED](docs/EventCONTEXTCOMPACTED.md) + - [EventDebugPrompt](docs/EventDebugPrompt.md) + - [EventDecompFailed](docs/EventDecompFailed.md) + - [EventDecompFinished](docs/EventDecompFinished.md) + - [EventProse](docs/EventProse.md) - [EventRUNCANCELLED](docs/EventRUNCANCELLED.md) - [EventRUNERROR](docs/EventRUNERROR.md) - [EventRUNFINISHED](docs/EventRUNFINISHED.md) - [EventRUNSTARTED](docs/EventRUNSTARTED.md) + - [EventRenameApplied](docs/EventRenameApplied.md) - [EventSTEPFINISHED](docs/EventSTEPFINISHED.md) - [EventSTEPSTARTED](docs/EventSTEPSTARTED.md) + - [EventSourceDelta](docs/EventSourceDelta.md) + - [EventSourceReset](docs/EventSourceReset.md) - [EventTEXTMESSAGECONTENT](docs/EventTEXTMESSAGECONTENT.md) - [EventTEXTMESSAGEEND](docs/EventTEXTMESSAGEEND.md) - [EventTEXTMESSAGESTART](docs/EventTEXTMESSAGESTART.md) @@ -402,6 +417,7 @@ Class | Method | HTTP request | Description - [EventTOOLCALLRESULT](docs/EventTOOLCALLRESULT.md) - [EventTOOLCALLSTART](docs/EventTOOLCALLSTART.md) - [EventTOOLCONFIRMATIONREQUIRED](docs/EventTOOLCONFIRMATIONREQUIRED.md) + - [EventWarning](docs/EventWarning.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) - [ExtractedURL](docs/ExtractedURL.md) @@ -494,6 +510,7 @@ Class | Method | HTTP request | Description - [ProcessNode](docs/ProcessNode.md) - [ProcessTree](docs/ProcessTree.md) - [ProgressMessage](docs/ProgressMessage.md) + - [ProseEvent](docs/ProseEvent.md) - [PutAnalysisStringsRequest](docs/PutAnalysisStringsRequest.md) - [QueuePositionResponse](docs/QueuePositionResponse.md) - [QueuedWorkflowTaskResponse](docs/QueuedWorkflowTaskResponse.md) @@ -503,6 +520,7 @@ Class | Method | HTTP request | Description - [RegenerateTarget](docs/RegenerateTarget.md) - [RegistryOperation](docs/RegistryOperation.md) - [RelativeBinaryResponse](docs/RelativeBinaryResponse.md) + - [RenameAppliedEvent](docs/RenameAppliedEvent.md) - [RenameInputBody](docs/RenameInputBody.md) - [RenameOutputBody](docs/RenameOutputBody.md) - [ReplacementValue](docs/ReplacementValue.md) @@ -526,6 +544,8 @@ Class | Method | HTTP request | Description - [SingleCodeSignatureModel](docs/SingleCodeSignatureModel.md) - [SinglePDBEntryModel](docs/SinglePDBEntryModel.md) - [SingleSectionModel](docs/SingleSectionModel.md) + - [SourceDeltaEvent](docs/SourceDeltaEvent.md) + - [SourceResetEvent](docs/SourceResetEvent.md) - [SseEventContextCompactedData](docs/SseEventContextCompactedData.md) - [SseEventRunCancelledData](docs/SseEventRunCancelledData.md) - [SseEventRunErrorData](docs/SseEventRunErrorData.md) @@ -547,6 +567,7 @@ Class | Method | HTTP request | Description - [StatusInput](docs/StatusInput.md) - [StatusOutput](docs/StatusOutput.md) - [StatusResponse](docs/StatusResponse.md) + - [StreamAiDecompilation200ResponseInner](docs/StreamAiDecompilation200ResponseInner.md) - [StreamEvents200ResponseInner](docs/StreamEvents200ResponseInner.md) - [StringFunctions](docs/StringFunctions.md) - [StringSource](docs/StringSource.md) @@ -578,6 +599,7 @@ Class | Method | HTTP request | Description - [UserActivityResponse](docs/UserActivityResponse.md) - [Vulnerabilities](docs/Vulnerabilities.md) - [Vulnerability](docs/Vulnerability.md) + - [WarningEvent](docs/WarningEvent.md) - [WorkflowProgress](docs/WorkflowProgress.md) - [Workspace](docs/Workspace.md) - [XrefFromResponse](docs/XrefFromResponse.md) diff --git a/docs/AttemptFailedEvent.md b/docs/AttemptFailedEvent.md new file mode 100644 index 00000000..aaf19b10 --- /dev/null +++ b/docs/AttemptFailedEvent.md @@ -0,0 +1,16 @@ + + +# AttemptFailedEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**error** | **String** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/AttemptStartedEvent.md b/docs/AttemptStartedEvent.md new file mode 100644 index 00000000..635da26d --- /dev/null +++ b/docs/AttemptStartedEvent.md @@ -0,0 +1,15 @@ + + +# AttemptStartedEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/DebugPromptEvent.md b/docs/DebugPromptEvent.md new file mode 100644 index 00000000..45f2044e --- /dev/null +++ b/docs/DebugPromptEvent.md @@ -0,0 +1,17 @@ + + +# DebugPromptEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**activity** | **String** | | | +|**attempt** | **Integer** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | +|**userPrompt** | **String** | | | + + + diff --git a/docs/DecompFailedEvent.md b/docs/DecompFailedEvent.md new file mode 100644 index 00000000..b998a5d8 --- /dev/null +++ b/docs/DecompFailedEvent.md @@ -0,0 +1,17 @@ + + +# DecompFailedEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**error** | **String** | | | +|**errorCode** | **String** | | [optional] | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/DecompFinishedEvent.md b/docs/DecompFinishedEvent.md new file mode 100644 index 00000000..680816d5 --- /dev/null +++ b/docs/DecompFinishedEvent.md @@ -0,0 +1,15 @@ + + +# DecompFinishedEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/EventAttemptFailed.md b/docs/EventAttemptFailed.md new file mode 100644 index 00000000..d0785f8d --- /dev/null +++ b/docs/EventAttemptFailed.md @@ -0,0 +1,25 @@ + + +# EventAttemptFailed + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **AttemptFailedEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| ATTEMPT_FAILED | "attempt_failed" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventAttemptStarted.md b/docs/EventAttemptStarted.md new file mode 100644 index 00000000..79bf23f5 --- /dev/null +++ b/docs/EventAttemptStarted.md @@ -0,0 +1,25 @@ + + +# EventAttemptStarted + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **AttemptStartedEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| ATTEMPT_STARTED | "attempt_started" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventDebugPrompt.md b/docs/EventDebugPrompt.md new file mode 100644 index 00000000..25e58484 --- /dev/null +++ b/docs/EventDebugPrompt.md @@ -0,0 +1,25 @@ + + +# EventDebugPrompt + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **DebugPromptEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| DEBUG_PROMPT | "debug_prompt" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventDecompFailed.md b/docs/EventDecompFailed.md new file mode 100644 index 00000000..b35cd520 --- /dev/null +++ b/docs/EventDecompFailed.md @@ -0,0 +1,25 @@ + + +# EventDecompFailed + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **DecompFailedEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| DECOMP_FAILED | "decomp_failed" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventDecompFinished.md b/docs/EventDecompFinished.md new file mode 100644 index 00000000..0a0d346f --- /dev/null +++ b/docs/EventDecompFinished.md @@ -0,0 +1,25 @@ + + +# EventDecompFinished + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **DecompFinishedEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| DECOMP_FINISHED | "decomp_finished" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventProse.md b/docs/EventProse.md new file mode 100644 index 00000000..d1259f78 --- /dev/null +++ b/docs/EventProse.md @@ -0,0 +1,25 @@ + + +# EventProse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **ProseEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| PROSE | "prose" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventRenameApplied.md b/docs/EventRenameApplied.md new file mode 100644 index 00000000..14272f71 --- /dev/null +++ b/docs/EventRenameApplied.md @@ -0,0 +1,25 @@ + + +# EventRenameApplied + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **RenameAppliedEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| RENAME_APPLIED | "rename_applied" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventSourceDelta.md b/docs/EventSourceDelta.md new file mode 100644 index 00000000..fd47d40e --- /dev/null +++ b/docs/EventSourceDelta.md @@ -0,0 +1,25 @@ + + +# EventSourceDelta + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **SourceDeltaEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| SOURCE_DELTA | "source_delta" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventSourceReset.md b/docs/EventSourceReset.md new file mode 100644 index 00000000..3771eab9 --- /dev/null +++ b/docs/EventSourceReset.md @@ -0,0 +1,25 @@ + + +# EventSourceReset + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **SourceResetEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| SOURCE_RESET | "source_reset" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EventWarning.md b/docs/EventWarning.md new file mode 100644 index 00000000..d7cd5cf0 --- /dev/null +++ b/docs/EventWarning.md @@ -0,0 +1,25 @@ + + +# EventWarning + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **WarningEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| WARNING | "warning" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/FunctionsAiDecompilationApi.md b/docs/FunctionsAiDecompilationApi.md index dc616def..622640ae 100644 --- a/docs/FunctionsAiDecompilationApi.md +++ b/docs/FunctionsAiDecompilationApi.md @@ -23,6 +23,7 @@ All URIs are relative to *https://api.reveng.ai* | [**patchAiDecompilationInlineComment**](FunctionsAiDecompilationApi.md#patchAiDecompilationInlineComment) | **PATCH** /v3/functions/{function_id}/ai-decompilation/inline-comments | Update a single inline comment | | [**regenerateAiDecompilationInlineComments**](FunctionsAiDecompilationApi.md#regenerateAiDecompilationInlineComments) | **POST** /v3/functions/{function_id}/ai-decompilation/inline-comments | Regenerate AI decompilation inline comments | | [**regenerateAiDecompilationSummary**](FunctionsAiDecompilationApi.md#regenerateAiDecompilationSummary) | **POST** /v3/functions/{function_id}/ai-decompilation/summary | Regenerate AI decompilation summary | +| [**streamAiDecompilation**](FunctionsAiDecompilationApi.md#streamAiDecompilation) | **GET** /v3/functions/{function_id}/ai-decompilation/events | Stream live AI decompilation output (SSE) | | [**updateAiDecompilationComment**](FunctionsAiDecompilationApi.md#updateAiDecompilationComment) | **PATCH** /v2/functions/{function_id}/ai-decompilation/comments/{comment_id} | Update a comment | | [**upsertAiDecompilationOverrides**](FunctionsAiDecompilationApi.md#upsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides | | [**upsertAiDecompilationRating**](FunctionsAiDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation | @@ -1418,6 +1419,76 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **streamAiDecompilation** +> List<StreamAiDecompilation200ResponseInner> streamAiDecompilation(functionId) + +Stream live AI decompilation output (SSE) + +Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal — Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported — clients fall back to polling the standard GET endpoint after the stream ends. + +### 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"); + + FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); + Long functionId = 56L; // Long | Function ID + try { + List result = apiInstance.streamAiDecompilation(functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsAiDecompilationApi#streamAiDecompilation"); + 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 + +[**List<StreamAiDecompilation200ResponseInner>**](StreamAiDecompilation200ResponseInner.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/event-stream, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **0** | Error | - | + # **updateAiDecompilationComment** > BaseResponseCommentResponse updateAiDecompilationComment(commentId, functionId, commentUpdateRequest) diff --git a/docs/ProseEvent.md b/docs/ProseEvent.md new file mode 100644 index 00000000..ad385a40 --- /dev/null +++ b/docs/ProseEvent.md @@ -0,0 +1,16 @@ + + +# ProseEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**seq** | **Integer** | | | +|**text** | **String** | | | +|**type** | **String** | | | + + + diff --git a/docs/RenameAppliedEvent.md b/docs/RenameAppliedEvent.md new file mode 100644 index 00000000..ff592b04 --- /dev/null +++ b/docs/RenameAppliedEvent.md @@ -0,0 +1,18 @@ + + +# RenameAppliedEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**addrHex** | **String** | | [optional] | +|**attempt** | **Integer** | | | +|**newName** | **String** | | | +|**oldName** | **String** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/SourceDeltaEvent.md b/docs/SourceDeltaEvent.md new file mode 100644 index 00000000..7ccd4953 --- /dev/null +++ b/docs/SourceDeltaEvent.md @@ -0,0 +1,16 @@ + + +# SourceDeltaEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**content** | **String** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/SourceResetEvent.md b/docs/SourceResetEvent.md new file mode 100644 index 00000000..1a9dd518 --- /dev/null +++ b/docs/SourceResetEvent.md @@ -0,0 +1,15 @@ + + +# SourceResetEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/docs/StreamAiDecompilation200ResponseInner.md b/docs/StreamAiDecompilation200ResponseInner.md new file mode 100644 index 00000000..0905c645 --- /dev/null +++ b/docs/StreamAiDecompilation200ResponseInner.md @@ -0,0 +1,25 @@ + + +# StreamAiDecompilation200ResponseInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**data** | **WarningEvent** | | | +|**event** | [**EventEnum**](#EventEnum) | The event name. | | +|**id** | **Integer** | The event ID. | [optional] | +|**retry** | **Integer** | The retry time in milliseconds. | [optional] | + + + +## Enum: EventEnum + +| Name | Value | +|---- | -----| +| WARNING | "warning" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/WarningEvent.md b/docs/WarningEvent.md new file mode 100644 index 00000000..1ea0128a --- /dev/null +++ b/docs/WarningEvent.md @@ -0,0 +1,18 @@ + + +# WarningEvent + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**attempt** | **Integer** | | | +|**identifiers** | **List<String>** | | [optional] | +|**kind** | **String** | | | +|**message** | **String** | | | +|**seq** | **Integer** | | | +|**type** | **String** | | | + + + diff --git a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java index 152e36a7..ed1de762 100644 --- a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java +++ b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java @@ -42,6 +42,7 @@ import ai.reveng.model.PatchCommentBody; import ai.reveng.model.RegenerateOutputBody; import ai.reveng.model.RegenerateTarget; +import ai.reveng.model.StreamAiDecompilation200ResponseInner; import ai.reveng.model.SummaryData; import ai.reveng.model.TokenisedData; import ai.reveng.model.UpsertAiDecomplationRatingRequest; @@ -2872,6 +2873,138 @@ public okhttp3.Call regenerateAiDecompilationSummaryAsync(@javax.annotation.Nonn localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for streamAiDecompilation + * @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 -
0 Error -
+ */ + public okhttp3.Call streamAiDecompilationCall(@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/events" + .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 = { + "text/event-stream", + "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" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call streamAiDecompilationValidateBeforeCall(@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 streamAiDecompilation(Async)"); + } + + return streamAiDecompilationCall(functionId, _callback); + + } + + /** + * Stream live AI decompilation output (SSE) + * Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal — Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported — clients fall back to polling the standard GET endpoint after the stream ends. + * @param functionId Function ID (required) + * @return List<StreamAiDecompilation200ResponseInner> + * @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 -
0 Error -
+ */ + public List streamAiDecompilation(@javax.annotation.Nonnull Long functionId) throws ApiException { + ApiResponse> localVarResp = streamAiDecompilationWithHttpInfo(functionId); + return localVarResp.getData(); + } + + /** + * Stream live AI decompilation output (SSE) + * Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal — Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported — clients fall back to polling the standard GET endpoint after the stream ends. + * @param functionId Function ID (required) + * @return ApiResponse<List<StreamAiDecompilation200ResponseInner>> + * @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 -
0 Error -
+ */ + public ApiResponse> streamAiDecompilationWithHttpInfo(@javax.annotation.Nonnull Long functionId) throws ApiException { + okhttp3.Call localVarCall = streamAiDecompilationValidateBeforeCall(functionId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Stream live AI decompilation output (SSE) (asynchronously) + * Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal — Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported — clients fall back to polling the standard GET endpoint after the stream ends. + * @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 -
0 Error -
+ */ + public okhttp3.Call streamAiDecompilationAsync(@javax.annotation.Nonnull Long functionId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = streamAiDecompilationValidateBeforeCall(functionId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for updateAiDecompilationComment * @param commentId (required) diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index 55eabca1..559023db 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -129,6 +129,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsTypesFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2InfoTypesCapability.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Argument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AttemptFailedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AttemptStartedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoRunAgents.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoUnstripRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoUnstripResponse.CustomTypeAdapterFactory()); @@ -246,6 +248,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateAIDecompOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateConversationRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Created.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DebugPromptEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompFailedEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompFinishedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompilationCommentContext.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompilationData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DieMatch.CustomTypeAdapterFactory()); @@ -265,13 +270,22 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ErrorBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ErrorModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Event.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventAttemptFailed.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventAttemptStarted.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventCONTEXTCOMPACTED.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventDebugPrompt.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventDecompFailed.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventDecompFinished.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventProse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventRUNCANCELLED.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventRUNERROR.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventRUNFINISHED.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventRUNSTARTED.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventRenameApplied.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventSTEPFINISHED.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventSTEPSTARTED.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventSourceDelta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventSourceReset.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTEXTMESSAGECONTENT.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTEXTMESSAGEEND.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EventTEXTMESSAGESTART.CustomTypeAdapterFactory()); @@ -281,6 +295,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.EventWarning.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExternalResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedURL.CustomTypeAdapterFactory()); @@ -365,6 +380,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessNode.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessTree.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProgressMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProseEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PutAnalysisStringsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.QueuePositionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.QueuedWorkflowTaskResponse.CustomTypeAdapterFactory()); @@ -373,6 +389,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RegenerateOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RegistryOperation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RelativeBinaryResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameAppliedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReplacementValue.CustomTypeAdapterFactory()); @@ -394,6 +411,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SingleCodeSignatureModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SinglePDBEntryModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SingleSectionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SourceDeltaEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SourceResetEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventContextCompactedData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventRunCancelledData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventRunErrorData.CustomTypeAdapterFactory()); @@ -414,6 +433,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartupInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusOutput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StreamAiDecompilation200ResponseInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StreamEvents200ResponseInner.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StringFunctions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Structure.CustomTypeAdapterFactory()); @@ -442,6 +462,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserActivityResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Vulnerabilities.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Vulnerability.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WarningEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WorkflowProgress.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefFromResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefResponse.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AttemptFailedEvent.java b/src/main/java/ai/reveng/model/AttemptFailedEvent.java new file mode 100644 index 00000000..8d2e9712 --- /dev/null +++ b/src/main/java/ai/reveng/model/AttemptFailedEvent.java @@ -0,0 +1,375 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * AttemptFailedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AttemptFailedEvent { + public static final String SERIALIZED_NAME_ATTEMPT = "attempt"; + @SerializedName(SERIALIZED_NAME_ATTEMPT) + @javax.annotation.Nonnull + private Integer attempt; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nonnull + private String error; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nonnull + private Integer seq; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public AttemptFailedEvent() { + } + + public AttemptFailedEvent 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 AttemptFailedEvent error(@javax.annotation.Nonnull String error) { + this.error = error; + return this; + } + + /** + * Get error + * @return error + */ + @javax.annotation.Nonnull + public String getError() { + return error; + } + + public void setError(@javax.annotation.Nonnull String error) { + this.error = error; + } + + + public AttemptFailedEvent 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 AttemptFailedEvent 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; + } + + /** + * 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 AttemptFailedEvent instance itself + */ + public AttemptFailedEvent 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; + } + AttemptFailedEvent attemptFailedEvent = (AttemptFailedEvent) o; + return Objects.equals(this.attempt, attemptFailedEvent.attempt) && + Objects.equals(this.error, attemptFailedEvent.error) && + Objects.equals(this.seq, attemptFailedEvent.seq) && + Objects.equals(this.type, attemptFailedEvent.type)&& + Objects.equals(this.additionalProperties, attemptFailedEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, error, seq, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttemptFailedEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "error", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "error", "seq", "type")); + } + + /** + * 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 AttemptFailedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AttemptFailedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AttemptFailedEvent is not found in the empty JSON string", AttemptFailedEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AttemptFailedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!AttemptFailedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AttemptFailedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AttemptFailedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AttemptFailedEvent 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 AttemptFailedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AttemptFailedEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AttemptFailedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of AttemptFailedEvent + * @throws IOException if the JSON string is invalid with respect to AttemptFailedEvent + */ + public static AttemptFailedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AttemptFailedEvent.class); + } + + /** + * Convert an instance of AttemptFailedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AttemptStartedEvent.java b/src/main/java/ai/reveng/model/AttemptStartedEvent.java new file mode 100644 index 00000000..ef236a8b --- /dev/null +++ b/src/main/java/ai/reveng/model/AttemptStartedEvent.java @@ -0,0 +1,346 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * AttemptStartedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AttemptStartedEvent { + 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_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public AttemptStartedEvent() { + } + + public AttemptStartedEvent 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 AttemptStartedEvent 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 AttemptStartedEvent 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; + } + + /** + * 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 AttemptStartedEvent instance itself + */ + public AttemptStartedEvent 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; + } + AttemptStartedEvent attemptStartedEvent = (AttemptStartedEvent) o; + return Objects.equals(this.attempt, attemptStartedEvent.attempt) && + Objects.equals(this.seq, attemptStartedEvent.seq) && + Objects.equals(this.type, attemptStartedEvent.type)&& + Objects.equals(this.additionalProperties, attemptStartedEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, seq, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttemptStartedEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "seq", "type")); + } + + /** + * 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 AttemptStartedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AttemptStartedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in AttemptStartedEvent is not found in the empty JSON string", AttemptStartedEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AttemptStartedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!AttemptStartedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AttemptStartedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AttemptStartedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AttemptStartedEvent 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 AttemptStartedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AttemptStartedEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AttemptStartedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of AttemptStartedEvent + * @throws IOException if the JSON string is invalid with respect to AttemptStartedEvent + */ + public static AttemptStartedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AttemptStartedEvent.class); + } + + /** + * Convert an instance of AttemptStartedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DebugPromptEvent.java b/src/main/java/ai/reveng/model/DebugPromptEvent.java new file mode 100644 index 00000000..70be76dc --- /dev/null +++ b/src/main/java/ai/reveng/model/DebugPromptEvent.java @@ -0,0 +1,404 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * DebugPromptEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DebugPromptEvent { + public static final String SERIALIZED_NAME_ACTIVITY = "activity"; + @SerializedName(SERIALIZED_NAME_ACTIVITY) + @javax.annotation.Nonnull + private String activity; + + 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_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public static final String SERIALIZED_NAME_USER_PROMPT = "user_prompt"; + @SerializedName(SERIALIZED_NAME_USER_PROMPT) + @javax.annotation.Nonnull + private String userPrompt; + + public DebugPromptEvent() { + } + + public DebugPromptEvent activity(@javax.annotation.Nonnull String activity) { + this.activity = activity; + return this; + } + + /** + * Get activity + * @return activity + */ + @javax.annotation.Nonnull + public String getActivity() { + return activity; + } + + public void setActivity(@javax.annotation.Nonnull String activity) { + this.activity = activity; + } + + + public DebugPromptEvent 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 DebugPromptEvent 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 DebugPromptEvent 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 DebugPromptEvent userPrompt(@javax.annotation.Nonnull String userPrompt) { + this.userPrompt = userPrompt; + return this; + } + + /** + * Get userPrompt + * @return userPrompt + */ + @javax.annotation.Nonnull + public String getUserPrompt() { + return userPrompt; + } + + public void setUserPrompt(@javax.annotation.Nonnull String userPrompt) { + this.userPrompt = userPrompt; + } + + /** + * 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 DebugPromptEvent instance itself + */ + public DebugPromptEvent 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; + } + DebugPromptEvent debugPromptEvent = (DebugPromptEvent) o; + return Objects.equals(this.activity, debugPromptEvent.activity) && + Objects.equals(this.attempt, debugPromptEvent.attempt) && + Objects.equals(this.seq, debugPromptEvent.seq) && + Objects.equals(this.type, debugPromptEvent.type) && + Objects.equals(this.userPrompt, debugPromptEvent.userPrompt)&& + Objects.equals(this.additionalProperties, debugPromptEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(activity, attempt, seq, type, userPrompt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DebugPromptEvent {\n"); + sb.append(" activity: ").append(toIndentedString(activity)).append("\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" userPrompt: ").append(toIndentedString(userPrompt)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("activity", "attempt", "seq", "type", "user_prompt")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("activity", "attempt", "seq", "type", "user_prompt")); + } + + /** + * 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 DebugPromptEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DebugPromptEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DebugPromptEvent is not found in the empty JSON string", DebugPromptEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DebugPromptEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("activity").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `activity` to be a primitive type in the JSON string but got `%s`", jsonObj.get("activity").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("user_prompt").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `user_prompt` to be a primitive type in the JSON string but got `%s`", jsonObj.get("user_prompt").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DebugPromptEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DebugPromptEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DebugPromptEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DebugPromptEvent 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 DebugPromptEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DebugPromptEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DebugPromptEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of DebugPromptEvent + * @throws IOException if the JSON string is invalid with respect to DebugPromptEvent + */ + public static DebugPromptEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DebugPromptEvent.class); + } + + /** + * Convert an instance of DebugPromptEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DecompFailedEvent.java b/src/main/java/ai/reveng/model/DecompFailedEvent.java new file mode 100644 index 00000000..4faf7d6c --- /dev/null +++ b/src/main/java/ai/reveng/model/DecompFailedEvent.java @@ -0,0 +1,404 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * DecompFailedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DecompFailedEvent { + public static final String SERIALIZED_NAME_ATTEMPT = "attempt"; + @SerializedName(SERIALIZED_NAME_ATTEMPT) + @javax.annotation.Nonnull + private Integer attempt; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nonnull + private String error; + + public static final String SERIALIZED_NAME_ERROR_CODE = "error_code"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + @javax.annotation.Nullable + private String errorCode; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nonnull + private Integer seq; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public DecompFailedEvent() { + } + + public DecompFailedEvent 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 DecompFailedEvent error(@javax.annotation.Nonnull String error) { + this.error = error; + return this; + } + + /** + * Get error + * @return error + */ + @javax.annotation.Nonnull + public String getError() { + return error; + } + + public void setError(@javax.annotation.Nonnull String error) { + this.error = error; + } + + + public DecompFailedEvent errorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * @return errorCode + */ + @javax.annotation.Nullable + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + } + + + public DecompFailedEvent 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 DecompFailedEvent 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; + } + + /** + * 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 DecompFailedEvent instance itself + */ + public DecompFailedEvent 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; + } + DecompFailedEvent decompFailedEvent = (DecompFailedEvent) o; + return Objects.equals(this.attempt, decompFailedEvent.attempt) && + Objects.equals(this.error, decompFailedEvent.error) && + Objects.equals(this.errorCode, decompFailedEvent.errorCode) && + Objects.equals(this.seq, decompFailedEvent.seq) && + Objects.equals(this.type, decompFailedEvent.type)&& + Objects.equals(this.additionalProperties, decompFailedEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, error, errorCode, seq, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DecompFailedEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "error", "error_code", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "error", "seq", "type")); + } + + /** + * 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 DecompFailedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DecompFailedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DecompFailedEvent is not found in the empty JSON string", DecompFailedEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DecompFailedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + } + if ((jsonObj.get("error_code") != null && !jsonObj.get("error_code").isJsonNull()) && !jsonObj.get("error_code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `error_code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error_code").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!DecompFailedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DecompFailedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DecompFailedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DecompFailedEvent 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 DecompFailedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DecompFailedEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DecompFailedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of DecompFailedEvent + * @throws IOException if the JSON string is invalid with respect to DecompFailedEvent + */ + public static DecompFailedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DecompFailedEvent.class); + } + + /** + * Convert an instance of DecompFailedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DecompFinishedEvent.java b/src/main/java/ai/reveng/model/DecompFinishedEvent.java new file mode 100644 index 00000000..a9568cfb --- /dev/null +++ b/src/main/java/ai/reveng/model/DecompFinishedEvent.java @@ -0,0 +1,346 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * DecompFinishedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DecompFinishedEvent { + 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_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public DecompFinishedEvent() { + } + + public DecompFinishedEvent 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 DecompFinishedEvent 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 DecompFinishedEvent 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; + } + + /** + * 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 DecompFinishedEvent instance itself + */ + public DecompFinishedEvent 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; + } + DecompFinishedEvent decompFinishedEvent = (DecompFinishedEvent) o; + return Objects.equals(this.attempt, decompFinishedEvent.attempt) && + Objects.equals(this.seq, decompFinishedEvent.seq) && + Objects.equals(this.type, decompFinishedEvent.type)&& + Objects.equals(this.additionalProperties, decompFinishedEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, seq, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DecompFinishedEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "seq", "type")); + } + + /** + * 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 DecompFinishedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DecompFinishedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in DecompFinishedEvent is not found in the empty JSON string", DecompFinishedEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DecompFinishedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!DecompFinishedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DecompFinishedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DecompFinishedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DecompFinishedEvent 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 DecompFinishedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DecompFinishedEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DecompFinishedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of DecompFinishedEvent + * @throws IOException if the JSON string is invalid with respect to DecompFinishedEvent + */ + public static DecompFinishedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DecompFinishedEvent.class); + } + + /** + * Convert an instance of DecompFinishedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventAttemptFailed.java b/src/main/java/ai/reveng/model/EventAttemptFailed.java new file mode 100644 index 00000000..fbdbb49f --- /dev/null +++ b/src/main/java/ai/reveng/model/EventAttemptFailed.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.AttemptFailedEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventAttemptFailed + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventAttemptFailed { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private AttemptFailedEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + ATTEMPT_FAILED("attempt_failed"), + + 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 EventAttemptFailed() { + } + + public EventAttemptFailed data(@javax.annotation.Nonnull AttemptFailedEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public AttemptFailedEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull AttemptFailedEvent data) { + this.data = data; + } + + + public EventAttemptFailed 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 EventAttemptFailed 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 EventAttemptFailed 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 EventAttemptFailed instance itself + */ + public EventAttemptFailed 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; + } + EventAttemptFailed eventAttemptFailed = (EventAttemptFailed) o; + return Objects.equals(this.data, eventAttemptFailed.data) && + Objects.equals(this.event, eventAttemptFailed.event) && + Objects.equals(this.id, eventAttemptFailed.id) && + Objects.equals(this.retry, eventAttemptFailed.retry)&& + Objects.equals(this.additionalProperties, eventAttemptFailed.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventAttemptFailed {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventAttemptFailed + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventAttemptFailed.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventAttemptFailed is not found in the empty JSON string", EventAttemptFailed.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventAttemptFailed.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventAttemptFailed.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventAttemptFailed' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventAttemptFailed.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventAttemptFailed 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 EventAttemptFailed read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventAttemptFailed instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventAttemptFailed given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventAttemptFailed + * @throws IOException if the JSON string is invalid with respect to EventAttemptFailed + */ + public static EventAttemptFailed fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventAttemptFailed.class); + } + + /** + * Convert an instance of EventAttemptFailed to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventAttemptStarted.java b/src/main/java/ai/reveng/model/EventAttemptStarted.java new file mode 100644 index 00000000..afe141d1 --- /dev/null +++ b/src/main/java/ai/reveng/model/EventAttemptStarted.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.AttemptStartedEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventAttemptStarted + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventAttemptStarted { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private AttemptStartedEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + ATTEMPT_STARTED("attempt_started"), + + 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 EventAttemptStarted() { + } + + public EventAttemptStarted data(@javax.annotation.Nonnull AttemptStartedEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public AttemptStartedEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull AttemptStartedEvent data) { + this.data = data; + } + + + public EventAttemptStarted 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 EventAttemptStarted 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 EventAttemptStarted 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 EventAttemptStarted instance itself + */ + public EventAttemptStarted 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; + } + EventAttemptStarted eventAttemptStarted = (EventAttemptStarted) o; + return Objects.equals(this.data, eventAttemptStarted.data) && + Objects.equals(this.event, eventAttemptStarted.event) && + Objects.equals(this.id, eventAttemptStarted.id) && + Objects.equals(this.retry, eventAttemptStarted.retry)&& + Objects.equals(this.additionalProperties, eventAttemptStarted.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventAttemptStarted {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventAttemptStarted + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventAttemptStarted.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventAttemptStarted is not found in the empty JSON string", EventAttemptStarted.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventAttemptStarted.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventAttemptStarted.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventAttemptStarted' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventAttemptStarted.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventAttemptStarted 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 EventAttemptStarted read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventAttemptStarted instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventAttemptStarted given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventAttemptStarted + * @throws IOException if the JSON string is invalid with respect to EventAttemptStarted + */ + public static EventAttemptStarted fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventAttemptStarted.class); + } + + /** + * Convert an instance of EventAttemptStarted to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventDebugPrompt.java b/src/main/java/ai/reveng/model/EventDebugPrompt.java new file mode 100644 index 00000000..5ddca50a --- /dev/null +++ b/src/main/java/ai/reveng/model/EventDebugPrompt.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.DebugPromptEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventDebugPrompt + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventDebugPrompt { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private DebugPromptEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + DEBUG_PROMPT("debug_prompt"), + + 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 EventDebugPrompt() { + } + + public EventDebugPrompt data(@javax.annotation.Nonnull DebugPromptEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public DebugPromptEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull DebugPromptEvent data) { + this.data = data; + } + + + public EventDebugPrompt 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 EventDebugPrompt 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 EventDebugPrompt 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 EventDebugPrompt instance itself + */ + public EventDebugPrompt 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; + } + EventDebugPrompt eventDebugPrompt = (EventDebugPrompt) o; + return Objects.equals(this.data, eventDebugPrompt.data) && + Objects.equals(this.event, eventDebugPrompt.event) && + Objects.equals(this.id, eventDebugPrompt.id) && + Objects.equals(this.retry, eventDebugPrompt.retry)&& + Objects.equals(this.additionalProperties, eventDebugPrompt.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventDebugPrompt {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventDebugPrompt + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventDebugPrompt.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventDebugPrompt is not found in the empty JSON string", EventDebugPrompt.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventDebugPrompt.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventDebugPrompt.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventDebugPrompt' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventDebugPrompt.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventDebugPrompt 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 EventDebugPrompt read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventDebugPrompt instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventDebugPrompt given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventDebugPrompt + * @throws IOException if the JSON string is invalid with respect to EventDebugPrompt + */ + public static EventDebugPrompt fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventDebugPrompt.class); + } + + /** + * Convert an instance of EventDebugPrompt to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventDecompFailed.java b/src/main/java/ai/reveng/model/EventDecompFailed.java new file mode 100644 index 00000000..34ad2085 --- /dev/null +++ b/src/main/java/ai/reveng/model/EventDecompFailed.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.DecompFailedEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventDecompFailed + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventDecompFailed { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private DecompFailedEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + DECOMP_FAILED("decomp_failed"), + + 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 EventDecompFailed() { + } + + public EventDecompFailed data(@javax.annotation.Nonnull DecompFailedEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public DecompFailedEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull DecompFailedEvent data) { + this.data = data; + } + + + public EventDecompFailed 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 EventDecompFailed 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 EventDecompFailed 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 EventDecompFailed instance itself + */ + public EventDecompFailed 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; + } + EventDecompFailed eventDecompFailed = (EventDecompFailed) o; + return Objects.equals(this.data, eventDecompFailed.data) && + Objects.equals(this.event, eventDecompFailed.event) && + Objects.equals(this.id, eventDecompFailed.id) && + Objects.equals(this.retry, eventDecompFailed.retry)&& + Objects.equals(this.additionalProperties, eventDecompFailed.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventDecompFailed {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventDecompFailed + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventDecompFailed.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventDecompFailed is not found in the empty JSON string", EventDecompFailed.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventDecompFailed.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventDecompFailed.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventDecompFailed' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventDecompFailed.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventDecompFailed 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 EventDecompFailed read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventDecompFailed instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventDecompFailed given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventDecompFailed + * @throws IOException if the JSON string is invalid with respect to EventDecompFailed + */ + public static EventDecompFailed fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventDecompFailed.class); + } + + /** + * Convert an instance of EventDecompFailed to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventDecompFinished.java b/src/main/java/ai/reveng/model/EventDecompFinished.java new file mode 100644 index 00000000..a77d7309 --- /dev/null +++ b/src/main/java/ai/reveng/model/EventDecompFinished.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.DecompFinishedEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventDecompFinished + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventDecompFinished { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private DecompFinishedEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + DECOMP_FINISHED("decomp_finished"), + + 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 EventDecompFinished() { + } + + public EventDecompFinished data(@javax.annotation.Nonnull DecompFinishedEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public DecompFinishedEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull DecompFinishedEvent data) { + this.data = data; + } + + + public EventDecompFinished 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 EventDecompFinished 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 EventDecompFinished 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 EventDecompFinished instance itself + */ + public EventDecompFinished 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; + } + EventDecompFinished eventDecompFinished = (EventDecompFinished) o; + return Objects.equals(this.data, eventDecompFinished.data) && + Objects.equals(this.event, eventDecompFinished.event) && + Objects.equals(this.id, eventDecompFinished.id) && + Objects.equals(this.retry, eventDecompFinished.retry)&& + Objects.equals(this.additionalProperties, eventDecompFinished.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventDecompFinished {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventDecompFinished + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventDecompFinished.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventDecompFinished is not found in the empty JSON string", EventDecompFinished.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventDecompFinished.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventDecompFinished.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventDecompFinished' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventDecompFinished.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventDecompFinished 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 EventDecompFinished read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventDecompFinished instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventDecompFinished given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventDecompFinished + * @throws IOException if the JSON string is invalid with respect to EventDecompFinished + */ + public static EventDecompFinished fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventDecompFinished.class); + } + + /** + * Convert an instance of EventDecompFinished to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventProse.java b/src/main/java/ai/reveng/model/EventProse.java new file mode 100644 index 00000000..96e5fe57 --- /dev/null +++ b/src/main/java/ai/reveng/model/EventProse.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.ProseEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventProse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventProse { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private ProseEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + PROSE("prose"), + + 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 EventProse() { + } + + public EventProse data(@javax.annotation.Nonnull ProseEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public ProseEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull ProseEvent data) { + this.data = data; + } + + + public EventProse 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 EventProse 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 EventProse 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 EventProse instance itself + */ + public EventProse 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; + } + EventProse eventProse = (EventProse) o; + return Objects.equals(this.data, eventProse.data) && + Objects.equals(this.event, eventProse.event) && + Objects.equals(this.id, eventProse.id) && + Objects.equals(this.retry, eventProse.retry)&& + Objects.equals(this.additionalProperties, eventProse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventProse {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventProse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventProse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventProse is not found in the empty JSON string", EventProse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventProse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventProse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventProse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventProse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventProse 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 EventProse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventProse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventProse given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventProse + * @throws IOException if the JSON string is invalid with respect to EventProse + */ + public static EventProse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventProse.class); + } + + /** + * Convert an instance of EventProse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventRenameApplied.java b/src/main/java/ai/reveng/model/EventRenameApplied.java new file mode 100644 index 00000000..6f6280eb --- /dev/null +++ b/src/main/java/ai/reveng/model/EventRenameApplied.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.RenameAppliedEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventRenameApplied + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventRenameApplied { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private RenameAppliedEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + RENAME_APPLIED("rename_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 EventRenameApplied() { + } + + public EventRenameApplied data(@javax.annotation.Nonnull RenameAppliedEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public RenameAppliedEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull RenameAppliedEvent data) { + this.data = data; + } + + + public EventRenameApplied 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 EventRenameApplied 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 EventRenameApplied 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 EventRenameApplied instance itself + */ + public EventRenameApplied 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; + } + EventRenameApplied eventRenameApplied = (EventRenameApplied) o; + return Objects.equals(this.data, eventRenameApplied.data) && + Objects.equals(this.event, eventRenameApplied.event) && + Objects.equals(this.id, eventRenameApplied.id) && + Objects.equals(this.retry, eventRenameApplied.retry)&& + Objects.equals(this.additionalProperties, eventRenameApplied.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventRenameApplied {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventRenameApplied + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventRenameApplied.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventRenameApplied is not found in the empty JSON string", EventRenameApplied.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventRenameApplied.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventRenameApplied.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventRenameApplied' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventRenameApplied.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventRenameApplied 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 EventRenameApplied read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventRenameApplied instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventRenameApplied given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventRenameApplied + * @throws IOException if the JSON string is invalid with respect to EventRenameApplied + */ + public static EventRenameApplied fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventRenameApplied.class); + } + + /** + * Convert an instance of EventRenameApplied to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventSourceDelta.java b/src/main/java/ai/reveng/model/EventSourceDelta.java new file mode 100644 index 00000000..97233dcd --- /dev/null +++ b/src/main/java/ai/reveng/model/EventSourceDelta.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.SourceDeltaEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventSourceDelta + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventSourceDelta { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private SourceDeltaEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + SOURCE_DELTA("source_delta"), + + 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 EventSourceDelta() { + } + + public EventSourceDelta data(@javax.annotation.Nonnull SourceDeltaEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public SourceDeltaEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull SourceDeltaEvent data) { + this.data = data; + } + + + public EventSourceDelta 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 EventSourceDelta 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 EventSourceDelta 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 EventSourceDelta instance itself + */ + public EventSourceDelta 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; + } + EventSourceDelta eventSourceDelta = (EventSourceDelta) o; + return Objects.equals(this.data, eventSourceDelta.data) && + Objects.equals(this.event, eventSourceDelta.event) && + Objects.equals(this.id, eventSourceDelta.id) && + Objects.equals(this.retry, eventSourceDelta.retry)&& + Objects.equals(this.additionalProperties, eventSourceDelta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventSourceDelta {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventSourceDelta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventSourceDelta.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventSourceDelta is not found in the empty JSON string", EventSourceDelta.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventSourceDelta.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventSourceDelta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventSourceDelta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventSourceDelta.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventSourceDelta 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 EventSourceDelta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventSourceDelta instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventSourceDelta given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventSourceDelta + * @throws IOException if the JSON string is invalid with respect to EventSourceDelta + */ + public static EventSourceDelta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventSourceDelta.class); + } + + /** + * Convert an instance of EventSourceDelta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventSourceReset.java b/src/main/java/ai/reveng/model/EventSourceReset.java new file mode 100644 index 00000000..7747c238 --- /dev/null +++ b/src/main/java/ai/reveng/model/EventSourceReset.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.SourceResetEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventSourceReset + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventSourceReset { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private SourceResetEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + SOURCE_RESET("source_reset"), + + 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 EventSourceReset() { + } + + public EventSourceReset data(@javax.annotation.Nonnull SourceResetEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public SourceResetEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull SourceResetEvent data) { + this.data = data; + } + + + public EventSourceReset 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 EventSourceReset 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 EventSourceReset 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 EventSourceReset instance itself + */ + public EventSourceReset 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; + } + EventSourceReset eventSourceReset = (EventSourceReset) o; + return Objects.equals(this.data, eventSourceReset.data) && + Objects.equals(this.event, eventSourceReset.event) && + Objects.equals(this.id, eventSourceReset.id) && + Objects.equals(this.retry, eventSourceReset.retry)&& + Objects.equals(this.additionalProperties, eventSourceReset.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventSourceReset {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventSourceReset + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventSourceReset.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventSourceReset is not found in the empty JSON string", EventSourceReset.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventSourceReset.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventSourceReset.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventSourceReset' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventSourceReset.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventSourceReset 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 EventSourceReset read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventSourceReset instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventSourceReset given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventSourceReset + * @throws IOException if the JSON string is invalid with respect to EventSourceReset + */ + public static EventSourceReset fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventSourceReset.class); + } + + /** + * Convert an instance of EventSourceReset to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EventWarning.java b/src/main/java/ai/reveng/model/EventWarning.java new file mode 100644 index 00000000..d2f5a8e1 --- /dev/null +++ b/src/main/java/ai/reveng/model/EventWarning.java @@ -0,0 +1,427 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.WarningEvent; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * EventWarning + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EventWarning { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nonnull + private WarningEvent data; + + /** + * The event name. + */ + @JsonAdapter(EventEnum.Adapter.class) + public enum EventEnum { + WARNING("warning"), + + 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 EventWarning() { + } + + public EventWarning data(@javax.annotation.Nonnull WarningEvent data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + public WarningEvent getData() { + return data; + } + + public void setData(@javax.annotation.Nonnull WarningEvent data) { + this.data = data; + } + + + public EventWarning 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 EventWarning 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 EventWarning 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 EventWarning instance itself + */ + public EventWarning 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; + } + EventWarning eventWarning = (EventWarning) o; + return Objects.equals(this.data, eventWarning.data) && + Objects.equals(this.event, eventWarning.event) && + Objects.equals(this.id, eventWarning.id) && + Objects.equals(this.retry, eventWarning.retry)&& + Objects.equals(this.additionalProperties, eventWarning.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, event, id, retry, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventWarning {\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) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("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 EventWarning + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventWarning.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in EventWarning is not found in the empty JSON string", EventWarning.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventWarning.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("event").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!EventWarning.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventWarning' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventWarning.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventWarning 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 EventWarning read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EventWarning instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EventWarning given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventWarning + * @throws IOException if the JSON string is invalid with respect to EventWarning + */ + public static EventWarning fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventWarning.class); + } + + /** + * Convert an instance of EventWarning to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ProseEvent.java b/src/main/java/ai/reveng/model/ProseEvent.java new file mode 100644 index 00000000..49ceef08 --- /dev/null +++ b/src/main/java/ai/reveng/model/ProseEvent.java @@ -0,0 +1,375 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * ProseEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ProseEvent { + 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_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public ProseEvent() { + } + + public ProseEvent 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 ProseEvent 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 ProseEvent text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Get text + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public ProseEvent 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; + } + + /** + * 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 ProseEvent instance itself + */ + public ProseEvent 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; + } + ProseEvent proseEvent = (ProseEvent) o; + return Objects.equals(this.attempt, proseEvent.attempt) && + Objects.equals(this.seq, proseEvent.seq) && + Objects.equals(this.text, proseEvent.text) && + Objects.equals(this.type, proseEvent.type)&& + Objects.equals(this.additionalProperties, proseEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, seq, text, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProseEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "seq", "text", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "seq", "text", "type")); + } + + /** + * 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 ProseEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProseEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ProseEvent is not found in the empty JSON string", ProseEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ProseEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!ProseEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProseEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProseEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProseEvent 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 ProseEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProseEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ProseEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProseEvent + * @throws IOException if the JSON string is invalid with respect to ProseEvent + */ + public static ProseEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProseEvent.class); + } + + /** + * Convert an instance of ProseEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/RenameAppliedEvent.java b/src/main/java/ai/reveng/model/RenameAppliedEvent.java new file mode 100644 index 00000000..fd6a7302 --- /dev/null +++ b/src/main/java/ai/reveng/model/RenameAppliedEvent.java @@ -0,0 +1,433 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * RenameAppliedEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RenameAppliedEvent { + public static final String SERIALIZED_NAME_ADDR_HEX = "addr_hex"; + @SerializedName(SERIALIZED_NAME_ADDR_HEX) + @javax.annotation.Nullable + private String addrHex; + + public static final String SERIALIZED_NAME_ATTEMPT = "attempt"; + @SerializedName(SERIALIZED_NAME_ATTEMPT) + @javax.annotation.Nonnull + private Integer attempt; + + public static final String SERIALIZED_NAME_NEW_NAME = "new_name"; + @SerializedName(SERIALIZED_NAME_NEW_NAME) + @javax.annotation.Nonnull + private String newName; + + public static final String SERIALIZED_NAME_OLD_NAME = "old_name"; + @SerializedName(SERIALIZED_NAME_OLD_NAME) + @javax.annotation.Nonnull + private String oldName; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nonnull + private Integer seq; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public RenameAppliedEvent() { + } + + public RenameAppliedEvent addrHex(@javax.annotation.Nullable String addrHex) { + this.addrHex = addrHex; + return this; + } + + /** + * Get addrHex + * @return addrHex + */ + @javax.annotation.Nullable + public String getAddrHex() { + return addrHex; + } + + public void setAddrHex(@javax.annotation.Nullable String addrHex) { + this.addrHex = addrHex; + } + + + public RenameAppliedEvent 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 RenameAppliedEvent newName(@javax.annotation.Nonnull String newName) { + this.newName = newName; + return this; + } + + /** + * Get newName + * @return newName + */ + @javax.annotation.Nonnull + public String getNewName() { + return newName; + } + + public void setNewName(@javax.annotation.Nonnull String newName) { + this.newName = newName; + } + + + public RenameAppliedEvent oldName(@javax.annotation.Nonnull String oldName) { + this.oldName = oldName; + return this; + } + + /** + * Get oldName + * @return oldName + */ + @javax.annotation.Nonnull + public String getOldName() { + return oldName; + } + + public void setOldName(@javax.annotation.Nonnull String oldName) { + this.oldName = oldName; + } + + + public RenameAppliedEvent 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 RenameAppliedEvent 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; + } + + /** + * 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 RenameAppliedEvent instance itself + */ + public RenameAppliedEvent 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; + } + RenameAppliedEvent renameAppliedEvent = (RenameAppliedEvent) o; + return Objects.equals(this.addrHex, renameAppliedEvent.addrHex) && + Objects.equals(this.attempt, renameAppliedEvent.attempt) && + Objects.equals(this.newName, renameAppliedEvent.newName) && + Objects.equals(this.oldName, renameAppliedEvent.oldName) && + Objects.equals(this.seq, renameAppliedEvent.seq) && + Objects.equals(this.type, renameAppliedEvent.type)&& + Objects.equals(this.additionalProperties, renameAppliedEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addrHex, attempt, newName, oldName, seq, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenameAppliedEvent {\n"); + sb.append(" addrHex: ").append(toIndentedString(addrHex)).append("\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" newName: ").append(toIndentedString(newName)).append("\n"); + sb.append(" oldName: ").append(toIndentedString(oldName)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("addr_hex", "attempt", "new_name", "old_name", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "new_name", "old_name", "seq", "type")); + } + + /** + * 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 RenameAppliedEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RenameAppliedEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in RenameAppliedEvent is not found in the empty JSON string", RenameAppliedEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RenameAppliedEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("addr_hex") != null && !jsonObj.get("addr_hex").isJsonNull()) && !jsonObj.get("addr_hex").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `addr_hex` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addr_hex").toString())); + } + if (!jsonObj.get("new_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `new_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("new_name").toString())); + } + if (!jsonObj.get("old_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `old_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("old_name").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!RenameAppliedEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RenameAppliedEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RenameAppliedEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RenameAppliedEvent 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 RenameAppliedEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RenameAppliedEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RenameAppliedEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of RenameAppliedEvent + * @throws IOException if the JSON string is invalid with respect to RenameAppliedEvent + */ + public static RenameAppliedEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RenameAppliedEvent.class); + } + + /** + * Convert an instance of RenameAppliedEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SourceDeltaEvent.java b/src/main/java/ai/reveng/model/SourceDeltaEvent.java new file mode 100644 index 00000000..892a04f9 --- /dev/null +++ b/src/main/java/ai/reveng/model/SourceDeltaEvent.java @@ -0,0 +1,375 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * SourceDeltaEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SourceDeltaEvent { + public static final String SERIALIZED_NAME_ATTEMPT = "attempt"; + @SerializedName(SERIALIZED_NAME_ATTEMPT) + @javax.annotation.Nonnull + private Integer attempt; + + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + @javax.annotation.Nonnull + private String content; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nonnull + private Integer seq; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public SourceDeltaEvent() { + } + + public SourceDeltaEvent 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 SourceDeltaEvent content(@javax.annotation.Nonnull String content) { + this.content = content; + return this; + } + + /** + * Get content + * @return content + */ + @javax.annotation.Nonnull + public String getContent() { + return content; + } + + public void setContent(@javax.annotation.Nonnull String content) { + this.content = content; + } + + + public SourceDeltaEvent 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 SourceDeltaEvent 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; + } + + /** + * 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 SourceDeltaEvent instance itself + */ + public SourceDeltaEvent 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; + } + SourceDeltaEvent sourceDeltaEvent = (SourceDeltaEvent) o; + return Objects.equals(this.attempt, sourceDeltaEvent.attempt) && + Objects.equals(this.content, sourceDeltaEvent.content) && + Objects.equals(this.seq, sourceDeltaEvent.seq) && + Objects.equals(this.type, sourceDeltaEvent.type)&& + Objects.equals(this.additionalProperties, sourceDeltaEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, content, seq, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceDeltaEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "content", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "content", "seq", "type")); + } + + /** + * 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 SourceDeltaEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceDeltaEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in SourceDeltaEvent is not found in the empty JSON string", SourceDeltaEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceDeltaEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("content").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `content` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!SourceDeltaEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceDeltaEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SourceDeltaEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceDeltaEvent 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 SourceDeltaEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SourceDeltaEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SourceDeltaEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceDeltaEvent + * @throws IOException if the JSON string is invalid with respect to SourceDeltaEvent + */ + public static SourceDeltaEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceDeltaEvent.class); + } + + /** + * Convert an instance of SourceDeltaEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SourceResetEvent.java b/src/main/java/ai/reveng/model/SourceResetEvent.java new file mode 100644 index 00000000..fdd6e1d3 --- /dev/null +++ b/src/main/java/ai/reveng/model/SourceResetEvent.java @@ -0,0 +1,346 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * SourceResetEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SourceResetEvent { + 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_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public SourceResetEvent() { + } + + public SourceResetEvent 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 SourceResetEvent 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 SourceResetEvent 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; + } + + /** + * 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 SourceResetEvent instance itself + */ + public SourceResetEvent 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; + } + SourceResetEvent sourceResetEvent = (SourceResetEvent) o; + return Objects.equals(this.attempt, sourceResetEvent.attempt) && + Objects.equals(this.seq, sourceResetEvent.seq) && + Objects.equals(this.type, sourceResetEvent.type)&& + Objects.equals(this.additionalProperties, sourceResetEvent.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, seq, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SourceResetEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "seq", "type")); + } + + /** + * 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 SourceResetEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SourceResetEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in SourceResetEvent is not found in the empty JSON string", SourceResetEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SourceResetEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!SourceResetEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SourceResetEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SourceResetEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SourceResetEvent 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 SourceResetEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SourceResetEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SourceResetEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of SourceResetEvent + * @throws IOException if the JSON string is invalid with respect to SourceResetEvent + */ + public static SourceResetEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SourceResetEvent.class); + } + + /** + * Convert an instance of SourceResetEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StreamAiDecompilation200ResponseInner.java b/src/main/java/ai/reveng/model/StreamAiDecompilation200ResponseInner.java new file mode 100644 index 00000000..dd53a3bb --- /dev/null +++ b/src/main/java/ai/reveng/model/StreamAiDecompilation200ResponseInner.java @@ -0,0 +1,637 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import ai.reveng.model.EventAttemptFailed; +import ai.reveng.model.EventAttemptStarted; +import ai.reveng.model.EventDebugPrompt; +import ai.reveng.model.EventDecompFailed; +import ai.reveng.model.EventDecompFinished; +import ai.reveng.model.EventProse; +import ai.reveng.model.EventRenameApplied; +import ai.reveng.model.EventSourceDelta; +import ai.reveng.model.EventSourceReset; +import ai.reveng.model.EventWarning; +import ai.reveng.model.WarningEvent; +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 java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Locale; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +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 com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import ai.reveng.invoker.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StreamAiDecompilation200ResponseInner extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(StreamAiDecompilation200ResponseInner.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StreamAiDecompilation200ResponseInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StreamAiDecompilation200ResponseInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterEventAttemptFailed = gson.getDelegateAdapter(this, TypeToken.get(EventAttemptFailed.class)); + final TypeAdapter adapterEventAttemptStarted = gson.getDelegateAdapter(this, TypeToken.get(EventAttemptStarted.class)); + final TypeAdapter adapterEventDebugPrompt = gson.getDelegateAdapter(this, TypeToken.get(EventDebugPrompt.class)); + final TypeAdapter adapterEventDecompFailed = gson.getDelegateAdapter(this, TypeToken.get(EventDecompFailed.class)); + final TypeAdapter adapterEventDecompFinished = gson.getDelegateAdapter(this, TypeToken.get(EventDecompFinished.class)); + final TypeAdapter adapterEventProse = gson.getDelegateAdapter(this, TypeToken.get(EventProse.class)); + 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 adapterEventWarning = gson.getDelegateAdapter(this, TypeToken.get(EventWarning.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StreamAiDecompilation200ResponseInner value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `EventAttemptFailed` + if (value.getActualInstance() instanceof EventAttemptFailed) { + JsonElement element = adapterEventAttemptFailed.toJsonTree((EventAttemptFailed)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventAttemptStarted` + if (value.getActualInstance() instanceof EventAttemptStarted) { + JsonElement element = adapterEventAttemptStarted.toJsonTree((EventAttemptStarted)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventDebugPrompt` + if (value.getActualInstance() instanceof EventDebugPrompt) { + JsonElement element = adapterEventDebugPrompt.toJsonTree((EventDebugPrompt)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventDecompFailed` + if (value.getActualInstance() instanceof EventDecompFailed) { + JsonElement element = adapterEventDecompFailed.toJsonTree((EventDecompFailed)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventDecompFinished` + if (value.getActualInstance() instanceof EventDecompFinished) { + JsonElement element = adapterEventDecompFinished.toJsonTree((EventDecompFinished)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventProse` + if (value.getActualInstance() instanceof EventProse) { + JsonElement element = adapterEventProse.toJsonTree((EventProse)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventRenameApplied` + if (value.getActualInstance() instanceof EventRenameApplied) { + JsonElement element = adapterEventRenameApplied.toJsonTree((EventRenameApplied)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventSourceDelta` + if (value.getActualInstance() instanceof EventSourceDelta) { + JsonElement element = adapterEventSourceDelta.toJsonTree((EventSourceDelta)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventSourceReset` + if (value.getActualInstance() instanceof EventSourceReset) { + JsonElement element = adapterEventSourceReset.toJsonTree((EventSourceReset)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EventWarning` + if (value.getActualInstance() instanceof EventWarning) { + JsonElement element = adapterEventWarning.toJsonTree((EventWarning)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDebugPrompt, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning"); + } + + @Override + public StreamAiDecompilation200ResponseInner read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize EventAttemptFailed + try { + // validate the JSON object to see if any exception is thrown + EventAttemptFailed.validateJsonElement(jsonElement); + actualAdapter = adapterEventAttemptFailed; + match++; + log.log(Level.FINER, "Input data matches schema 'EventAttemptFailed'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventAttemptFailed failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventAttemptFailed'", e); + } + // deserialize EventAttemptStarted + try { + // validate the JSON object to see if any exception is thrown + EventAttemptStarted.validateJsonElement(jsonElement); + actualAdapter = adapterEventAttemptStarted; + match++; + log.log(Level.FINER, "Input data matches schema 'EventAttemptStarted'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventAttemptStarted failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventAttemptStarted'", e); + } + // deserialize EventDebugPrompt + try { + // validate the JSON object to see if any exception is thrown + EventDebugPrompt.validateJsonElement(jsonElement); + actualAdapter = adapterEventDebugPrompt; + match++; + log.log(Level.FINER, "Input data matches schema 'EventDebugPrompt'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventDebugPrompt failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventDebugPrompt'", e); + } + // deserialize EventDecompFailed + try { + // validate the JSON object to see if any exception is thrown + EventDecompFailed.validateJsonElement(jsonElement); + actualAdapter = adapterEventDecompFailed; + match++; + log.log(Level.FINER, "Input data matches schema 'EventDecompFailed'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventDecompFailed failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventDecompFailed'", e); + } + // deserialize EventDecompFinished + try { + // validate the JSON object to see if any exception is thrown + EventDecompFinished.validateJsonElement(jsonElement); + actualAdapter = adapterEventDecompFinished; + match++; + log.log(Level.FINER, "Input data matches schema 'EventDecompFinished'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventDecompFinished failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventDecompFinished'", e); + } + // deserialize EventProse + try { + // validate the JSON object to see if any exception is thrown + EventProse.validateJsonElement(jsonElement); + actualAdapter = adapterEventProse; + match++; + log.log(Level.FINER, "Input data matches schema 'EventProse'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventProse failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventProse'", e); + } + // deserialize EventRenameApplied + try { + // validate the JSON object to see if any exception is thrown + EventRenameApplied.validateJsonElement(jsonElement); + actualAdapter = adapterEventRenameApplied; + match++; + log.log(Level.FINER, "Input data matches schema 'EventRenameApplied'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventRenameApplied failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventRenameApplied'", e); + } + // deserialize EventSourceDelta + try { + // validate the JSON object to see if any exception is thrown + EventSourceDelta.validateJsonElement(jsonElement); + actualAdapter = adapterEventSourceDelta; + match++; + log.log(Level.FINER, "Input data matches schema 'EventSourceDelta'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventSourceDelta failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventSourceDelta'", e); + } + // deserialize EventSourceReset + try { + // validate the JSON object to see if any exception is thrown + EventSourceReset.validateJsonElement(jsonElement); + actualAdapter = adapterEventSourceReset; + match++; + log.log(Level.FINER, "Input data matches schema 'EventSourceReset'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventSourceReset failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventSourceReset'", e); + } + // deserialize EventWarning + try { + // validate the JSON object to see if any exception is thrown + EventWarning.validateJsonElement(jsonElement); + actualAdapter = adapterEventWarning; + match++; + log.log(Level.FINER, "Input data matches schema 'EventWarning'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventWarning failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EventWarning'", e); + } + + if (match == 1) { + StreamAiDecompilation200ResponseInner ret = new StreamAiDecompilation200ResponseInner(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format(Locale.ROOT, "Failed deserialization for StreamAiDecompilation200ResponseInner: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public StreamAiDecompilation200ResponseInner() { + super("oneOf", Boolean.FALSE); + } + + public StreamAiDecompilation200ResponseInner(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("EventAttemptFailed", EventAttemptFailed.class); + schemas.put("EventAttemptStarted", EventAttemptStarted.class); + schemas.put("EventDebugPrompt", EventDebugPrompt.class); + schemas.put("EventDecompFailed", EventDecompFailed.class); + schemas.put("EventDecompFinished", EventDecompFinished.class); + schemas.put("EventProse", EventProse.class); + schemas.put("EventRenameApplied", EventRenameApplied.class); + schemas.put("EventSourceDelta", EventSourceDelta.class); + schemas.put("EventSourceReset", EventSourceReset.class); + schemas.put("EventWarning", EventWarning.class); + } + + @Override + public Map> getSchemas() { + return StreamAiDecompilation200ResponseInner.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * EventAttemptFailed, EventAttemptStarted, EventDebugPrompt, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof EventAttemptFailed) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventAttemptStarted) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventDebugPrompt) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventDecompFailed) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventDecompFinished) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventProse) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventRenameApplied) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventSourceDelta) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventSourceReset) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EventWarning) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EventAttemptFailed, EventAttemptStarted, EventDebugPrompt, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning"); + } + + /** + * Get the actual instance, which can be the following: + * EventAttemptFailed, EventAttemptStarted, EventDebugPrompt, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning + * + * @return The actual instance (EventAttemptFailed, EventAttemptStarted, EventDebugPrompt, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `EventAttemptFailed`. If the actual instance is not `EventAttemptFailed`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventAttemptFailed` + * @throws ClassCastException if the instance is not `EventAttemptFailed` + */ + public EventAttemptFailed getEventAttemptFailed() throws ClassCastException { + return (EventAttemptFailed)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventAttemptStarted`. If the actual instance is not `EventAttemptStarted`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventAttemptStarted` + * @throws ClassCastException if the instance is not `EventAttemptStarted` + */ + public EventAttemptStarted getEventAttemptStarted() throws ClassCastException { + return (EventAttemptStarted)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventDebugPrompt`. If the actual instance is not `EventDebugPrompt`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventDebugPrompt` + * @throws ClassCastException if the instance is not `EventDebugPrompt` + */ + public EventDebugPrompt getEventDebugPrompt() throws ClassCastException { + return (EventDebugPrompt)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventDecompFailed`. If the actual instance is not `EventDecompFailed`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventDecompFailed` + * @throws ClassCastException if the instance is not `EventDecompFailed` + */ + public EventDecompFailed getEventDecompFailed() throws ClassCastException { + return (EventDecompFailed)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventDecompFinished`. If the actual instance is not `EventDecompFinished`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventDecompFinished` + * @throws ClassCastException if the instance is not `EventDecompFinished` + */ + public EventDecompFinished getEventDecompFinished() throws ClassCastException { + return (EventDecompFinished)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventProse`. If the actual instance is not `EventProse`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventProse` + * @throws ClassCastException if the instance is not `EventProse` + */ + public EventProse getEventProse() throws ClassCastException { + return (EventProse)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventRenameApplied`. If the actual instance is not `EventRenameApplied`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventRenameApplied` + * @throws ClassCastException if the instance is not `EventRenameApplied` + */ + public EventRenameApplied getEventRenameApplied() throws ClassCastException { + return (EventRenameApplied)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventSourceDelta`. If the actual instance is not `EventSourceDelta`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventSourceDelta` + * @throws ClassCastException if the instance is not `EventSourceDelta` + */ + public EventSourceDelta getEventSourceDelta() throws ClassCastException { + return (EventSourceDelta)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventSourceReset`. If the actual instance is not `EventSourceReset`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventSourceReset` + * @throws ClassCastException if the instance is not `EventSourceReset` + */ + public EventSourceReset getEventSourceReset() throws ClassCastException { + return (EventSourceReset)super.getActualInstance(); + } + + /** + * Get the actual instance of `EventWarning`. If the actual instance is not `EventWarning`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EventWarning` + * @throws ClassCastException if the instance is not `EventWarning` + */ + public EventWarning getEventWarning() throws ClassCastException { + return (EventWarning)super.getActualInstance(); + } + + /** + * 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 StreamAiDecompilation200ResponseInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with EventAttemptFailed + try { + EventAttemptFailed.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventAttemptFailed failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventAttemptStarted + try { + EventAttemptStarted.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventAttemptStarted failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventDebugPrompt + try { + EventDebugPrompt.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventDebugPrompt failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventDecompFailed + try { + EventDecompFailed.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventDecompFailed failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventDecompFinished + try { + EventDecompFinished.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventDecompFinished failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventProse + try { + EventProse.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventProse failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventRenameApplied + try { + EventRenameApplied.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventRenameApplied failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventSourceDelta + try { + EventSourceDelta.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventSourceDelta failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventSourceReset + try { + EventSourceReset.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventSourceReset failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EventWarning + try { + EventWarning.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(Locale.ROOT, "Deserialization for EventWarning failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format(Locale.ROOT, "The JSON string is invalid for StreamAiDecompilation200ResponseInner with oneOf schemas: EventAttemptFailed, EventAttemptStarted, EventDebugPrompt, EventDecompFailed, EventDecompFinished, EventProse, EventRenameApplied, EventSourceDelta, EventSourceReset, EventWarning. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of StreamAiDecompilation200ResponseInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of StreamAiDecompilation200ResponseInner + * @throws IOException if the JSON string is invalid with respect to StreamAiDecompilation200ResponseInner + */ + public static StreamAiDecompilation200ResponseInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StreamAiDecompilation200ResponseInner.class); + } + + /** + * Convert an instance of StreamAiDecompilation200ResponseInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/WarningEvent.java b/src/main/java/ai/reveng/model/WarningEvent.java new file mode 100644 index 00000000..2bfb0dc3 --- /dev/null +++ b/src/main/java/ai/reveng/model/WarningEvent.java @@ -0,0 +1,456 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import ai.reveng.invoker.JSON; + +/** + * WarningEvent + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WarningEvent { + public static final String SERIALIZED_NAME_ATTEMPT = "attempt"; + @SerializedName(SERIALIZED_NAME_ATTEMPT) + @javax.annotation.Nonnull + private Integer attempt; + + public static final String SERIALIZED_NAME_IDENTIFIERS = "identifiers"; + @SerializedName(SERIALIZED_NAME_IDENTIFIERS) + @javax.annotation.Nullable + private List identifiers; + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private String kind; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + public static final String SERIALIZED_NAME_SEQ = "seq"; + @SerializedName(SERIALIZED_NAME_SEQ) + @javax.annotation.Nonnull + private Integer seq; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nonnull + private String type; + + public WarningEvent() { + } + + public WarningEvent 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 WarningEvent identifiers(@javax.annotation.Nullable List identifiers) { + this.identifiers = identifiers; + return this; + } + + public WarningEvent addIdentifiersItem(String identifiersItem) { + if (this.identifiers == null) { + this.identifiers = new ArrayList<>(); + } + this.identifiers.add(identifiersItem); + return this; + } + + /** + * Get identifiers + * @return identifiers + */ + @javax.annotation.Nullable + public List getIdentifiers() { + return identifiers; + } + + public void setIdentifiers(@javax.annotation.Nullable List identifiers) { + this.identifiers = identifiers; + } + + + public WarningEvent kind(@javax.annotation.Nonnull String kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public String getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull String kind) { + this.kind = kind; + } + + + public WarningEvent message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + + public WarningEvent 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 WarningEvent 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; + } + + /** + * 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 WarningEvent instance itself + */ + public WarningEvent 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; + } + WarningEvent warningEvent = (WarningEvent) o; + return Objects.equals(this.attempt, warningEvent.attempt) && + Objects.equals(this.identifiers, warningEvent.identifiers) && + Objects.equals(this.kind, warningEvent.kind) && + Objects.equals(this.message, warningEvent.message) && + Objects.equals(this.seq, warningEvent.seq) && + Objects.equals(this.type, warningEvent.type)&& + Objects.equals(this.additionalProperties, warningEvent.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(attempt, identifiers, kind, message, seq, type, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WarningEvent {\n"); + sb.append(" attempt: ").append(toIndentedString(attempt)).append("\n"); + sb.append(" identifiers: ").append(toIndentedString(identifiers)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" seq: ").append(toIndentedString(seq)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("attempt", "identifiers", "kind", "message", "seq", "type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("attempt", "kind", "message", "seq", "type")); + } + + /** + * 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 WarningEvent + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WarningEvent.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in WarningEvent is not found in the empty JSON string", WarningEvent.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WarningEvent.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("identifiers") != null && !jsonObj.get("identifiers").isJsonNull() && !jsonObj.get("identifiers").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `identifiers` to be an array in the JSON string but got `%s`", jsonObj.get("identifiers").toString())); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(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 (!WarningEvent.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WarningEvent' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WarningEvent.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WarningEvent 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 WarningEvent read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WarningEvent instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WarningEvent given an JSON string + * + * @param jsonString JSON string + * @return An instance of WarningEvent + * @throws IOException if the JSON string is invalid with respect to WarningEvent + */ + public static WarningEvent fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WarningEvent.class); + } + + /** + * Convert an instance of WarningEvent to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +