diff --git a/.sdk-version b/.sdk-version index 4fc4729..18ef788 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v4.54.0 +v4.60.1 diff --git a/README.md b/README.md index 6c99f7e..46480fe 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 4.54.0 + 4.60.1 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:4.54.0" + implementation "ai.reveng:sdk:4.60.1" } ``` @@ -133,6 +133,7 @@ Class | Method | HTTP request | Description *AgentApi* | [**v3UpsertBinaryAgentFeedback**](docs/AgentApi.md#v3UpsertBinaryAgentFeedback) | **PUT** /v3/analyses/{analysis_id}/agents/{agent}/feedback | Record feedback on an agent's output. *AnalysesBulkActionsApi* | [**bulkAddAnalysisTags**](docs/AnalysesBulkActionsApi.md#bulkAddAnalysisTags) | **PATCH** /v2/analyses/tags/add | Bulk Add Analysis Tags *AnalysesBulkActionsApi* | [**bulkDeleteAnalyses**](docs/AnalysesBulkActionsApi.md#bulkDeleteAnalyses) | **PATCH** /v2/analyses/delete | Bulk Delete Analyses +*AnalysesBulkActionsApi* | [**v3BatchAddAnalysisTags**](docs/AnalysesBulkActionsApi.md#v3BatchAddAnalysisTags) | **POST** /v3/analyses:batchAddTags | Add tags to multiple analyses. *AnalysesBulkActionsApi* | [**v3BatchDeleteAnalyses**](docs/AnalysesBulkActionsApi.md#v3BatchDeleteAnalyses) | **POST** /v3/analyses:batchDelete | Delete multiple analyses. *AnalysesCommentsApi* | [**createAnalysisComment**](docs/AnalysesCommentsApi.md#createAnalysisComment) | **POST** /v2/analyses/{analysis_id}/comments | Create a comment for this analysis *AnalysesCommentsApi* | [**deleteAnalysisComment**](docs/AnalysesCommentsApi.md#deleteAnalysisComment) | **DELETE** /v2/analyses/{analysis_id}/comments/{comment_id} | Delete a comment @@ -176,13 +177,17 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**v3ListExampleAnalyses**](docs/AnalysesCoreApi.md#v3ListExampleAnalyses) | **GET** /v3/analyses/examples | List example analyses *AnalysesCoreApi* | [**v3LookupAnalysisByBinaryId**](docs/AnalysesCoreApi.md#v3LookupAnalysisByBinaryId) | **GET** /v3/analyses/lookup/{binary_id} | Look up the most recent analysis for a binary. *AnalysesCoreApi* | [**v3QueueBinaryExport**](docs/AnalysesCoreApi.md#v3QueueBinaryExport) | **POST** /v3/analyses/{analysis_id}/binary-export | Queue a binary export +*AnalysesCoreApi* | [**v3SearchTags**](docs/AnalysesCoreApi.md#v3SearchTags) | **GET** /v3/tags | Search tags *AnalysesCoreApi* | [**v3UpdateAnalysis**](docs/AnalysesCoreApi.md#v3UpdateAnalysis) | **PATCH** /v3/analyses/{analysis_id} | Update an analysis. +*AnalysesCoreApi* | [**v3UpdateAnalysisTags**](docs/AnalysesCoreApi.md#v3UpdateAnalysisTags) | **PATCH** /v3/analyses/{analysis_id}/tags | Replace an analysis' tags. *AnalysesCoreApi* | [**v3UpgradeAnalysisModel**](docs/AnalysesCoreApi.md#v3UpgradeAnalysisModel) | **POST** /v3/analyses/{analysis_id}/upgrade-model | Re-analyse on the latest model *AnalysesResultsMetadataApi* | [**getAnalysisFunctionsPaginated**](docs/AnalysesResultsMetadataApi.md#getAnalysisFunctionsPaginated) | **GET** /v2/analyses/{analysis_id}/functions | Get functions from analysis *AnalysesResultsMetadataApi* | [**getCapabilities**](docs/AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis *AnalysesResultsMetadataApi* | [**getFunctionsList**](docs/AnalysesResultsMetadataApi.md#getFunctionsList) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis *AnalysesResultsMetadataApi* | [**getTags**](docs/AnalysesResultsMetadataApi.md#getTags) | **GET** /v2/analyses/{analysis_id}/tags | Get function tags with maliciousness score +*AnalysesResultsMetadataApi* | [**v3GetAnalysisXref**](docs/AnalysesResultsMetadataApi.md#v3GetAnalysisXref) | **GET** /v3/analyses/{analysis_id}/xrefs/{vaddr} | Look up xrefs by virtual address. *AnalysesResultsMetadataApi* | [**v3ListAnalysisCapabilities**](docs/AnalysesResultsMetadataApi.md#v3ListAnalysisCapabilities) | **GET** /v3/analyses/{analysis_id}/capabilities | List the capabilities found in an analysis. +*AnalysesResultsMetadataApi* | [**v3ListAnalysisTags**](docs/AnalysesResultsMetadataApi.md#v3ListAnalysisTags) | **GET** /v3/analyses/{analysis_id}/tags | List the tags on an analysis. *AnalysesXRefsApi* | [**getXrefByVaddr**](docs/AnalysesXRefsApi.md#getXrefByVaddr) | **GET** /v2/analyses/{analysis_id}/xrefs/{vaddr} | [Beta] Look up xrefs by virtual address *AuthenticationUsersApi* | [**getUser**](docs/AuthenticationUsersApi.md#getUser) | **GET** /v2/users/{user_id} | Get a user's public information *AuthenticationUsersApi* | [**getUserActivity**](docs/AuthenticationUsersApi.md#getUserActivity) | **GET** /v2/users/activity | Get auth user activity @@ -197,9 +202,12 @@ Class | Method | HTTP request | Description *BinariesApi* | [**getBinaryExternals**](docs/BinariesApi.md#getBinaryExternals) | **GET** /v2/binaries/{binary_id}/externals | Gets the external details of a binary *BinariesApi* | [**getBinaryRelatedStatus**](docs/BinariesApi.md#getBinaryRelatedStatus) | **GET** /v2/binaries/{binary_id}/related/status | Gets the status of the unpack binary task for a binary *BinariesApi* | [**getRelatedBinaries**](docs/BinariesApi.md#getRelatedBinaries) | **GET** /v2/binaries/{binary_id}/related | Gets the related binaries of a binary. +*BinariesApi* | [**v3DownloadBinaryZipped**](docs/BinariesApi.md#v3DownloadBinaryZipped) | **GET** /v3/binaries/{binary_id}/download-zipped | Download a binary as a password-protected zip. *BinariesApi* | [**v3GetBinaryDieInfo**](docs/BinariesApi.md#v3GetBinaryDieInfo) | **GET** /v3/binaries/{binary_id}/die-info | Get Detect It Easy matches for a binary. +*BinariesApi* | [**v3GetBinaryExternals**](docs/BinariesApi.md#v3GetBinaryExternals) | **GET** /v3/binaries/{binary_id}/externals | Get third-party threat-intel lookups for a binary. *BinariesApi* | [**v3GetBinaryRelated**](docs/BinariesApi.md#v3GetBinaryRelated) | **GET** /v3/binaries/{binary_id}/related | Get the binaries related to this one by unpacking. *BinariesApi* | [**v3GetBinaryRelatedStatus**](docs/BinariesApi.md#v3GetBinaryRelatedStatus) | **GET** /v3/binaries/{binary_id}/related/status | Get the archive-unpacking status for a binary. +*BinariesApi* | [**v3SearchBinaries**](docs/BinariesApi.md#v3SearchBinaries) | **GET** /v3/binaries | Search binaries *BinariesApi* | [**v3UploadFile**](docs/BinariesApi.md#v3UploadFile) | **POST** /v3/upload | Upload a file. *CollectionsApi* | [**createCollection**](docs/CollectionsApi.md#createCollection) | **POST** /v2/collections | Creates new collection information *CollectionsApi* | [**deleteCollection**](docs/CollectionsApi.md#deleteCollection) | **DELETE** /v2/collections/{collection_id} | Deletes a collection @@ -255,6 +263,7 @@ Class | Method | HTTP request | Description *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* | [**upsertAiDecompilationRating**](docs/FunctionsAiDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation +*FunctionsAiDecompilationApi* | [**v3AcceptAiDecompilationTypeSuggestions**](docs/FunctionsAiDecompilationApi.md#v3AcceptAiDecompilationTypeSuggestions) | **POST** /v3/functions/{function_id}/ai-decompilation/type-suggestions/accept | Accept AI decompilation type suggestions *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationLineAttributions**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationLineAttributions) | **GET** /v3/functions/{function_id}/ai-decompilation/line-attributions | Get AI decompilation line attributions *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTokens**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTypeSuggestions**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestions) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Get AI decompilation type suggestions @@ -283,6 +292,7 @@ Class | Method | HTTP request | Description *FunctionsCoreApi* | [**listImportedFunctions**](docs/FunctionsCoreApi.md#listImportedFunctions) | **GET** /v3/analyses/{analysis_id}/imported-functions | List imported functions in an analysis *FunctionsCoreApi* | [**startFunctionsMatching**](docs/FunctionsCoreApi.md#startFunctionsMatching) | **POST** /v3/functions/matches | Start function matching for an explicit set of functions *FunctionsCoreApi* | [**v3CanonicalizeFunctionNames**](docs/FunctionsCoreApi.md#v3CanonicalizeFunctionNames) | **POST** /v3/functions/canonical-names | Canonicalize a batch of function names +*FunctionsCoreApi* | [**v3SearchFunctions**](docs/FunctionsCoreApi.md#v3SearchFunctions) | **GET** /v3/functions | Search functions *FunctionsRenamingHistoryApi* | [**batchRenameFunction**](docs/FunctionsRenamingHistoryApi.md#batchRenameFunction) | **POST** /v2/functions/rename/batch | Batch Rename Functions *FunctionsRenamingHistoryApi* | [**batchRenameFunctions**](docs/FunctionsRenamingHistoryApi.md#batchRenameFunctions) | **POST** /v3/functions/rename | Batch rename functions *FunctionsRenamingHistoryApi* | [**getFunctionHistory**](docs/FunctionsRenamingHistoryApi.md#getFunctionHistory) | **GET** /v3/functions/{function_id}/history | Get function name history @@ -306,6 +316,9 @@ Class | Method | HTTP request | Description ## Documentation for Models - [APIError](docs/APIError.md) + - [AcceptTypeSuggestionsInputBody](docs/AcceptTypeSuggestionsInputBody.md) + - [AcceptTypeSuggestionsOutputBody](docs/AcceptTypeSuggestionsOutputBody.md) + - [AcceptedType](docs/AcceptedType.md) - [AddCalleeInputBody](docs/AddCalleeInputBody.md) - [AddCollectionBinariesInputBody](docs/AddCollectionBinariesInputBody.md) - [AddIssuerDomainInputBody](docs/AddIssuerDomainInputBody.md) @@ -314,7 +327,9 @@ Class | Method | HTTP request | Description - [AddUserStringInputBody](docs/AddUserStringInputBody.md) - [AddUserStringToFunctionInputBody](docs/AddUserStringToFunctionInputBody.md) - [AdditionalDetailsStatusResponse](docs/AdditionalDetailsStatusResponse.md) + - [AgentWorkflowUsageOutputBody](docs/AgentWorkflowUsageOutputBody.md) - [AiDecompilationRating](docs/AiDecompilationRating.md) + - [AnalyseCapabilitiesBody](docs/AnalyseCapabilitiesBody.md) - [AnalysisAccessBody](docs/AnalysisAccessBody.md) - [AnalysisAccessInfo](docs/AnalysisAccessInfo.md) - [AnalysisBasicInfoOutputBody](docs/AnalysisBasicInfoOutputBody.md) @@ -350,9 +365,11 @@ Class | Method | HTTP request | Description - [AnalysisStringsStatusResponse](docs/AnalysisStringsStatusResponse.md) - [AnalysisTagBody](docs/AnalysisTagBody.md) - [AnalysisTags](docs/AnalysisTags.md) + - [AnalysisTagsOutputBody](docs/AnalysisTagsOutputBody.md) - [AnalysisUpdateRequest](docs/AnalysisUpdateRequest.md) - [AnalysisUpdateTagsRequest](docs/AnalysisUpdateTagsRequest.md) - [AnalysisUpdateTagsResponse](docs/AnalysisUpdateTagsResponse.md) + - [AnalysisXrefOutputBody](docs/AnalysisXrefOutputBody.md) - [ApiCall](docs/ApiCall.md) - [ApiCombinationEvidence](docs/ApiCombinationEvidence.md) - [AppApiRestV2AgentSchemaCapability](docs/AppApiRestV2AgentSchemaCapability.md) @@ -449,11 +466,16 @@ Class | Method | HTTP request | Description - [BinaryDetailsResponse](docs/BinaryDetailsResponse.md) - [BinaryExportMetadata](docs/BinaryExportMetadata.md) - [BinaryExportResult](docs/BinaryExportResult.md) + - [BinaryExternalsBody](docs/BinaryExternalsBody.md) - [BinaryExternalsResponse](docs/BinaryExternalsResponse.md) - [BinarySearchResponse](docs/BinarySearchResponse.md) - [BinarySearchResult](docs/BinarySearchResult.md) + - [BinarySearchResultBody](docs/BinarySearchResultBody.md) - [BinaryTaskStatus](docs/BinaryTaskStatus.md) - [BitfieldDataType](docs/BitfieldDataType.md) + - [BulkAddTagsInputBody](docs/BulkAddTagsInputBody.md) + - [BulkAddTagsOutputBody](docs/BulkAddTagsOutputBody.md) + - [BulkAddTagsResultBody](docs/BulkAddTagsResultBody.md) - [BulkCreateUserResult](docs/BulkCreateUserResult.md) - [BulkCreateUsersOutputBody](docs/BulkCreateUsersOutputBody.md) - [BulkDeleteAnalysesInputBody](docs/BulkDeleteAnalysesInputBody.md) @@ -531,6 +553,8 @@ Class | Method | HTTP request | Description - [CreateStructDataType](docs/CreateStructDataType.md) - [CreateTeamInputBody](docs/CreateTeamInputBody.md) - [CreateTypedefDataType](docs/CreateTypedefDataType.md) + - [CreateURLRequest](docs/CreateURLRequest.md) + - [CreateURLResponse](docs/CreateURLResponse.md) - [CreateUnionDataType](docs/CreateUnionDataType.md) - [CreateUnknownDataType](docs/CreateUnknownDataType.md) - [CreateUserInputBody](docs/CreateUserInputBody.md) @@ -543,6 +567,9 @@ Class | Method | HTTP request | Description - [CryptoFinding](docs/CryptoFinding.md) - [CryptoScanMetadata](docs/CryptoScanMetadata.md) - [CryptoScanResult](docs/CryptoScanResult.md) + - [CryptoVerification](docs/CryptoVerification.md) + - [DailyAnalysesCountOutputBody](docs/DailyAnalysesCountOutputBody.md) + - [DailyCountBody](docs/DailyCountBody.md) - [DataTypeEntry](docs/DataTypeEntry.md) - [DataTypeEnumValueEntry](docs/DataTypeEnumValueEntry.md) - [DataTypeFunctionEntry](docs/DataTypeFunctionEntry.md) @@ -617,6 +644,7 @@ Class | Method | HTTP request | Description - [ExecutionFinding](docs/ExecutionFinding.md) - [ExecutionScanMetadata](docs/ExecutionScanMetadata.md) - [ExecutionScanResult](docs/ExecutionScanResult.md) + - [ExecutionVerification](docs/ExecutionVerification.md) - [ExportModel](docs/ExportModel.md) - [ExternalResponse](docs/ExternalResponse.md) - [ExtractedBinary](docs/ExtractedBinary.md) @@ -635,6 +663,7 @@ Class | Method | HTTP request | Description - [FilesystemFinding](docs/FilesystemFinding.md) - [FilesystemScanMetadata](docs/FilesystemScanMetadata.md) - [FilesystemScanResult](docs/FilesystemScanResult.md) + - [FilesystemVerification](docs/FilesystemVerification.md) - [Filters](docs/Filters.md) - [Finding](docs/Finding.md) - [FormFile](docs/FormFile.md) @@ -656,6 +685,7 @@ Class | Method | HTTP request | Description - [FunctionRenameMap](docs/FunctionRenameMap.md) - [FunctionSearchResponse](docs/FunctionSearchResponse.md) - [FunctionSearchResult](docs/FunctionSearchResult.md) + - [FunctionSearchResultBody](docs/FunctionSearchResultBody.md) - [FunctionSignatureBody](docs/FunctionSignatureBody.md) - [FunctionSignatureEntry](docs/FunctionSignatureEntry.md) - [FunctionSignatureVersion](docs/FunctionSignatureVersion.md) @@ -675,6 +705,7 @@ Class | Method | HTTP request | Description - [GetAiDecompilationRatingResponse](docs/GetAiDecompilationRatingResponse.md) - [GetAnalysisLogsOutputBody](docs/GetAnalysisLogsOutputBody.md) - [GetAnalysisStringsStatusOutputBody](docs/GetAnalysisStringsStatusOutputBody.md) + - [GetBinaryExternalsOutputBody](docs/GetBinaryExternalsOutputBody.md) - [GetCollectionOutputBody](docs/GetCollectionOutputBody.md) - [GetConfigOutputBody](docs/GetConfigOutputBody.md) - [GetDataTypeHistoryBody](docs/GetDataTypeHistoryBody.md) @@ -756,6 +787,7 @@ Class | Method | HTTP request | Description - [NetworkingFinding](docs/NetworkingFinding.md) - [NetworkingScanMetadata](docs/NetworkingScanMetadata.md) - [NetworkingScanResult](docs/NetworkingScanResult.md) + - [NetworkingVerification](docs/NetworkingVerification.md) - [OIDCCallbackInputBody](docs/OIDCCallbackInputBody.md) - [OperationBinaryExportMetadataBinaryExportResult](docs/OperationBinaryExportMetadataBinaryExportResult.md) - [OperationCreateMetadataCreateResult](docs/OperationCreateMetadataCreateResult.md) @@ -827,6 +859,7 @@ Class | Method | HTTP request | Description - [RenameOutputBody](docs/RenameOutputBody.md) - [RenameUnnamedFunctionsResult](docs/RenameUnnamedFunctionsResult.md) - [RenderedToken](docs/RenderedToken.md) + - [ReportAnalysisBody](docs/ReportAnalysisBody.md) - [ReportAnalysisResponse](docs/ReportAnalysisResponse.md) - [ReportEvent](docs/ReportEvent.md) - [ReportInfo](docs/ReportInfo.md) @@ -848,6 +881,9 @@ Class | Method | HTTP request | Description - [ScrapeThirdPartyConfig](docs/ScrapeThirdPartyConfig.md) - [ScreenshotEntry](docs/ScreenshotEntry.md) - [ScreenshotsIndex](docs/ScreenshotsIndex.md) + - [SearchBinariesOutputBody](docs/SearchBinariesOutputBody.md) + - [SearchFunctionsOutputBody](docs/SearchFunctionsOutputBody.md) + - [SearchTagsOutputBody](docs/SearchTagsOutputBody.md) - [SecretsAgentResponse](docs/SecretsAgentResponse.md) - [SectionModel](docs/SectionModel.md) - [SecurityFinding](docs/SecurityFinding.md) @@ -868,6 +904,7 @@ Class | Method | HTTP request | Description - [SingleCodeSignatureModel](docs/SingleCodeSignatureModel.md) - [SinglePDBEntryModel](docs/SinglePDBEntryModel.md) - [SingleSectionModel](docs/SingleSectionModel.md) + - [SoftwareTypeCountsBody](docs/SoftwareTypeCountsBody.md) - [SourceDeltaEvent](docs/SourceDeltaEvent.md) - [SourceResetEvent](docs/SourceResetEvent.md) - [SseEventContextCompactedData](docs/SseEventContextCompactedData.md) @@ -920,6 +957,7 @@ Class | Method | HTTP request | Description - [TagResponse](docs/TagResponse.md) - [TagSearchResponse](docs/TagSearchResponse.md) - [TagSearchResult](docs/TagSearchResult.md) + - [TagSearchResultBody](docs/TagSearchResultBody.md) - [TaskResponse](docs/TaskResponse.md) - [TaskStatus](docs/TaskStatus.md) - [TaskStatusResponse](docs/TaskStatusResponse.md) @@ -970,6 +1008,7 @@ Class | Method | HTTP request | Description - [UpdatePointerDataType](docs/UpdatePointerDataType.md) - [UpdateProfileInputBody](docs/UpdateProfileInputBody.md) - [UpdateStructDataType](docs/UpdateStructDataType.md) + - [UpdateTagsInputBody](docs/UpdateTagsInputBody.md) - [UpdateTeamInputBody](docs/UpdateTeamInputBody.md) - [UpdateTypedefDataType](docs/UpdateTypedefDataType.md) - [UpdateUnionDataType](docs/UpdateUnionDataType.md) @@ -990,10 +1029,14 @@ Class | Method | HTTP request | Description - [UserIdentity](docs/UserIdentity.md) - [UserProfile](docs/UserProfile.md) - [WarningEvent](docs/WarningEvent.md) + - [WorkflowDayBody](docs/WorkflowDayBody.md) - [WorkflowProgress](docs/WorkflowProgress.md) - [Workspace](docs/Workspace.md) + - [XrefFromBody](docs/XrefFromBody.md) - [XrefFromResponse](docs/XrefFromResponse.md) + - [XrefIntoBody](docs/XrefIntoBody.md) - [XrefResponse](docs/XrefResponse.md) + - [XrefSegmentBody](docs/XrefSegmentBody.md) - [XrefToResponse](docs/XrefToResponse.md) diff --git a/build.gradle b/build.gradle index 6a1febf..0da4aa8 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '4.54.0' +version = '4.60.1' @@ -174,7 +174,7 @@ mavenPublishing { // key, and signing without one fails the build. if (project.hasProperty("signingInMemoryKey")) signAllPublications() - coordinates("ai.reveng", "sdk", "4.54.0") + coordinates("ai.reveng", "sdk", "4.60.1") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index edeb6c1..139d375 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "4.54.0", + version := "4.60.1", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AcceptTypeSuggestionsInputBody.md b/docs/AcceptTypeSuggestionsInputBody.md new file mode 100644 index 0000000..052de06 --- /dev/null +++ b/docs/AcceptTypeSuggestionsInputBody.md @@ -0,0 +1,13 @@ + + +# AcceptTypeSuggestionsInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**keys** | **List<String>** | Keys of the suggestions to store, as the type suggestions endpoint returns them. A key repeated in one request is stored once. | | + + + diff --git a/docs/AcceptTypeSuggestionsOutputBody.md b/docs/AcceptTypeSuggestionsOutputBody.md new file mode 100644 index 0000000..3e2fa84 --- /dev/null +++ b/docs/AcceptTypeSuggestionsOutputBody.md @@ -0,0 +1,14 @@ + + +# AcceptTypeSuggestionsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accepted** | **List<AcceptedType>** | One entry per requested suggestion, in request order. | | +|**dataTypes** | [**List<DataTypeEntry>**](DataTypeEntry.md) | The type each requested suggestion resolved to, plus every type minted to satisfy one, ordered by data_type_id. | | + + + diff --git a/docs/AcceptedType.md b/docs/AcceptedType.md new file mode 100644 index 0000000..fe0aa82 --- /dev/null +++ b/docs/AcceptedType.md @@ -0,0 +1,16 @@ + + +# AcceptedType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**created** | **Boolean** | False when the analysis already held a type under this name and kind, which this request resolved to rather than replaced. | | +|**dataTypeId** | **Long** | The data type the suggestion is now stored as. | | +|**key** | **String** | The suggestion this entry answers. | | +|**skippedMembers** | **Long** | Members left out of the stored type because no offset or width was established for them. | | + + + diff --git a/docs/AgentWorkflowUsageOutputBody.md b/docs/AgentWorkflowUsageOutputBody.md new file mode 100644 index 0000000..c4c957d --- /dev/null +++ b/docs/AgentWorkflowUsageOutputBody.md @@ -0,0 +1,13 @@ + + +# AgentWorkflowUsageOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**report** | **List<WorkflowDayBody>** | One entry per day in the requested window, oldest first | | + + + diff --git a/docs/AnalyseCapabilitiesBody.md b/docs/AnalyseCapabilitiesBody.md new file mode 100644 index 0000000..d50beaa --- /dev/null +++ b/docs/AnalyseCapabilitiesBody.md @@ -0,0 +1,13 @@ + + +# AnalyseCapabilitiesBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**completed** | **Long** | ANALYSE_CAPABILITIES agent tasks completed that day | | + + + diff --git a/docs/AnalysesBulkActionsApi.md b/docs/AnalysesBulkActionsApi.md index cf201a1..997a1cc 100644 --- a/docs/AnalysesBulkActionsApi.md +++ b/docs/AnalysesBulkActionsApi.md @@ -6,6 +6,7 @@ All URIs are relative to *https://api.reveng.ai* |------------- | ------------- | -------------| | [**bulkAddAnalysisTags**](AnalysesBulkActionsApi.md#bulkAddAnalysisTags) | **PATCH** /v2/analyses/tags/add | Bulk Add Analysis Tags | | [**bulkDeleteAnalyses**](AnalysesBulkActionsApi.md#bulkDeleteAnalyses) | **PATCH** /v2/analyses/delete | Bulk Delete Analyses | +| [**v3BatchAddAnalysisTags**](AnalysesBulkActionsApi.md#v3BatchAddAnalysisTags) | **POST** /v3/analyses:batchAddTags | Add tags to multiple analyses. | | [**v3BatchDeleteAnalyses**](AnalysesBulkActionsApi.md#v3BatchDeleteAnalyses) | **POST** /v3/analyses:batchDelete | Delete multiple analyses. | @@ -159,6 +160,83 @@ public class Example { | **404** | Not Found | - | | **403** | Forbidden | - | + +# **v3BatchAddAnalysisTags** +> BulkAddTagsOutputBody v3BatchAddAnalysisTags(bulkAddTagsInputBody) + +Add tags to multiple analyses. + +Adds tags (origin RevEng) to every given analysis' binary. The caller must own every analysis, or none are changed. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesBulkActionsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesBulkActionsApi apiInstance = new AnalysesBulkActionsApi(defaultClient); + BulkAddTagsInputBody bulkAddTagsInputBody = new BulkAddTagsInputBody(); // BulkAddTagsInputBody | + try { + BulkAddTagsOutputBody result = apiInstance.v3BatchAddAnalysisTags(bulkAddTagsInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesBulkActionsApi#v3BatchAddAnalysisTags"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **bulkAddTagsInputBody** | [**BulkAddTagsInputBody**](BulkAddTagsInputBody.md)| | | + +### Return type + +[**BulkAddTagsOutputBody**](BulkAddTagsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3BatchDeleteAnalyses** > v3BatchDeleteAnalyses(bulkDeleteAnalysesInputBody) diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 4200dca..f663ffd 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -42,7 +42,9 @@ All URIs are relative to *https://api.reveng.ai* | [**v3ListExampleAnalyses**](AnalysesCoreApi.md#v3ListExampleAnalyses) | **GET** /v3/analyses/examples | List example analyses | | [**v3LookupAnalysisByBinaryId**](AnalysesCoreApi.md#v3LookupAnalysisByBinaryId) | **GET** /v3/analyses/lookup/{binary_id} | Look up the most recent analysis for a binary. | | [**v3QueueBinaryExport**](AnalysesCoreApi.md#v3QueueBinaryExport) | **POST** /v3/analyses/{analysis_id}/binary-export | Queue a binary export | +| [**v3SearchTags**](AnalysesCoreApi.md#v3SearchTags) | **GET** /v3/tags | Search tags | | [**v3UpdateAnalysis**](AnalysesCoreApi.md#v3UpdateAnalysis) | **PATCH** /v3/analyses/{analysis_id} | Update an analysis. | +| [**v3UpdateAnalysisTags**](AnalysesCoreApi.md#v3UpdateAnalysisTags) | **PATCH** /v3/analyses/{analysis_id}/tags | Replace an analysis' tags. | | [**v3UpgradeAnalysisModel**](AnalysesCoreApi.md#v3UpgradeAnalysisModel) | **POST** /v3/analyses/{analysis_id}/upgrade-model | Re-analyse on the latest model | @@ -3018,6 +3020,85 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3SearchTags** +> SearchTagsOutputBody v3SearchTags(partialName, limit, offset) + +Search tags + +Searches for tags by name. partial_name is required and must be at least 3 characters. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + String partialName = "partialName_example"; // String | Partial or full tag name to search for, at least 3 characters + Long limit = 10L; // Long | Maximum results to return + Long offset = 0L; // Long | Number of results to skip + try { + SearchTagsOutputBody result = apiInstance.v3SearchTags(partialName, limit, offset); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#v3SearchTags"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **partialName** | **String**| Partial or full tag name to search for, at least 3 characters | [optional] | +| **limit** | **Long**| Maximum results to return | [optional] [default to 10] | +| **offset** | **Long**| Number of results to skip | [optional] [default to 0] | + +### Return type + +[**SearchTagsOutputBody**](SearchTagsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3UpdateAnalysis** > AnalysisDetailOutputBody v3UpdateAnalysis(analysisId, updateAnalysisInputBody) @@ -3098,6 +3179,85 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3UpdateAnalysisTags** +> AnalysisTagsOutputBody v3UpdateAnalysisTags(analysisId, updateTagsInputBody) + +Replace an analysis' tags. + +Replaces the analysis' binary's user tags (origin RevEng) with the given set. A tag recorded under any other origin, such as a heuristic detection sharing a name with a user tag, is left in place even when its name is absent from the request. Only the owner may call it. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + UpdateTagsInputBody updateTagsInputBody = new UpdateTagsInputBody(); // UpdateTagsInputBody | + try { + AnalysisTagsOutputBody result = apiInstance.v3UpdateAnalysisTags(analysisId, updateTagsInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#v3UpdateAnalysisTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Long**| Analysis ID | | +| **updateTagsInputBody** | [**UpdateTagsInputBody**](UpdateTagsInputBody.md)| | | + +### Return type + +[**AnalysisTagsOutputBody**](AnalysisTagsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3UpgradeAnalysisModel** > UpgradeAnalysisModelOutputBody v3UpgradeAnalysisModel(analysisId) diff --git a/docs/AnalysesResultsMetadataApi.md b/docs/AnalysesResultsMetadataApi.md index 7dc6e39..7791294 100644 --- a/docs/AnalysesResultsMetadataApi.md +++ b/docs/AnalysesResultsMetadataApi.md @@ -8,7 +8,9 @@ All URIs are relative to *https://api.reveng.ai* | [**getCapabilities**](AnalysesResultsMetadataApi.md#getCapabilities) | **GET** /v2/analyses/{analysis_id}/capabilities | Gets the capabilities from the analysis | | [**getFunctionsList**](AnalysesResultsMetadataApi.md#getFunctionsList) | **GET** /v2/analyses/{analysis_id}/functions/list | Gets functions from analysis | | [**getTags**](AnalysesResultsMetadataApi.md#getTags) | **GET** /v2/analyses/{analysis_id}/tags | Get function tags with maliciousness score | +| [**v3GetAnalysisXref**](AnalysesResultsMetadataApi.md#v3GetAnalysisXref) | **GET** /v3/analyses/{analysis_id}/xrefs/{vaddr} | Look up xrefs by virtual address. | | [**v3ListAnalysisCapabilities**](AnalysesResultsMetadataApi.md#v3ListAnalysisCapabilities) | **GET** /v3/analyses/{analysis_id}/capabilities | List the capabilities found in an analysis. | +| [**v3ListAnalysisTags**](AnalysesResultsMetadataApi.md#v3ListAnalysisTags) | **GET** /v3/analyses/{analysis_id}/tags | List the tags on an analysis. | @@ -319,6 +321,85 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **v3GetAnalysisXref** +> AnalysisXrefOutputBody v3GetAnalysisXref(analysisId, vaddr) + +Look up xrefs by virtual address. + +Returns every cross-reference into and out of a virtual address, read from the analysis' cache. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesResultsMetadataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesResultsMetadataApi apiInstance = new AnalysesResultsMetadataApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long vaddr = 56L; // Long | Virtual address to match against xrefs + try { + AnalysisXrefOutputBody result = apiInstance.v3GetAnalysisXref(analysisId, vaddr); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesResultsMetadataApi#v3GetAnalysisXref"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Long**| Analysis ID | | +| **vaddr** | **Long**| Virtual address to match against xrefs | | + +### Return type + +[**AnalysisXrefOutputBody**](AnalysisXrefOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3ListAnalysisCapabilities** > AnalysisCapabilitiesOutputBody v3ListAnalysisCapabilities(analysisId) @@ -396,3 +477,80 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3ListAnalysisTags** +> AnalysisTagsOutputBody v3ListAnalysisTags(analysisId) + +List the tags on an analysis. + +Returns every tag on the analysis' binary, of any origin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesResultsMetadataApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesResultsMetadataApi apiInstance = new AnalysesResultsMetadataApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + AnalysisTagsOutputBody result = apiInstance.v3ListAnalysisTags(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesResultsMetadataApi#v3ListAnalysisTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **analysisId** | **Long**| Analysis ID | | + +### Return type + +[**AnalysisTagsOutputBody**](AnalysisTagsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/AnalysisTagsOutputBody.md b/docs/AnalysisTagsOutputBody.md new file mode 100644 index 0000000..be726fa --- /dev/null +++ b/docs/AnalysisTagsOutputBody.md @@ -0,0 +1,13 @@ + + +# AnalysisTagsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tags** | **List<AnalysisTagBody>** | Every tag on the analysis' binary, of any origin | | + + + diff --git a/docs/AnalysisXrefOutputBody.md b/docs/AnalysisXrefOutputBody.md new file mode 100644 index 0000000..2d43863 --- /dev/null +++ b/docs/AnalysisXrefOutputBody.md @@ -0,0 +1,14 @@ + + +# AnalysisXrefOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**xrefFromList** | **List<XrefFromBody>** | Xrefs that originate at the queried vaddr, one per target address | | +|**xrefToList** | **List<XrefIntoBody>** | Xrefs that target the queried vaddr, one per referencing address | | + + + diff --git a/docs/BinariesApi.md b/docs/BinariesApi.md index a2c4d1a..91bdd03 100644 --- a/docs/BinariesApi.md +++ b/docs/BinariesApi.md @@ -14,9 +14,12 @@ All URIs are relative to *https://api.reveng.ai* | [**getBinaryExternals**](BinariesApi.md#getBinaryExternals) | **GET** /v2/binaries/{binary_id}/externals | Gets the external details of a binary | | [**getBinaryRelatedStatus**](BinariesApi.md#getBinaryRelatedStatus) | **GET** /v2/binaries/{binary_id}/related/status | Gets the status of the unpack binary task for a binary | | [**getRelatedBinaries**](BinariesApi.md#getRelatedBinaries) | **GET** /v2/binaries/{binary_id}/related | Gets the related binaries of a binary. | +| [**v3DownloadBinaryZipped**](BinariesApi.md#v3DownloadBinaryZipped) | **GET** /v3/binaries/{binary_id}/download-zipped | Download a binary as a password-protected zip. | | [**v3GetBinaryDieInfo**](BinariesApi.md#v3GetBinaryDieInfo) | **GET** /v3/binaries/{binary_id}/die-info | Get Detect It Easy matches for a binary. | +| [**v3GetBinaryExternals**](BinariesApi.md#v3GetBinaryExternals) | **GET** /v3/binaries/{binary_id}/externals | Get third-party threat-intel lookups for a binary. | | [**v3GetBinaryRelated**](BinariesApi.md#v3GetBinaryRelated) | **GET** /v3/binaries/{binary_id}/related | Get the binaries related to this one by unpacking. | | [**v3GetBinaryRelatedStatus**](BinariesApi.md#v3GetBinaryRelatedStatus) | **GET** /v3/binaries/{binary_id}/related/status | Get the archive-unpacking status for a binary. | +| [**v3SearchBinaries**](BinariesApi.md#v3SearchBinaries) | **GET** /v3/binaries | Search binaries | | [**v3UploadFile**](BinariesApi.md#v3UploadFile) | **POST** /v3/upload | Upload a file. | @@ -751,6 +754,82 @@ public class Example { | **422** | Invalid request parameters | - | | **403** | Forbidden | - | + +# **v3DownloadBinaryZipped** +> v3DownloadBinaryZipped(binaryId) + +Download a binary as a password-protected zip. + +Streams the binary's uploaded file back as a zip archive, encrypted with a fixed password (`infected`) that deters antivirus scanning in transit rather than protecting confidentiality. Only the binary's owner, or an admin/superadmin, may download it; an internally-managed account's binary can only be downloaded by a superadmin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.BinariesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + BinariesApi apiInstance = new BinariesApi(defaultClient); + Long binaryId = 56L; // Long | Binary ID + try { + apiInstance.v3DownloadBinaryZipped(binaryId); + } catch (ApiException e) { + System.err.println("Exception when calling BinariesApi#v3DownloadBinaryZipped"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **binaryId** | **Long**| Binary ID | | + +### Return type + +null (empty response body) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3GetBinaryDieInfo** > GetDieInfoOutputBody v3GetBinaryDieInfo(binaryId) @@ -828,6 +907,83 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3GetBinaryExternals** +> GetBinaryExternalsOutputBody v3GetBinaryExternals(binaryId) + +Get third-party threat-intel lookups for a binary. + +Returns VirusTotal and MalwareBazaar lookup results for the binary's content hash. `externals` is null until at least one lookup has run. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.BinariesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + BinariesApi apiInstance = new BinariesApi(defaultClient); + Long binaryId = 56L; // Long | Binary ID + try { + GetBinaryExternalsOutputBody result = apiInstance.v3GetBinaryExternals(binaryId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BinariesApi#v3GetBinaryExternals"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **binaryId** | **Long**| Binary ID | | + +### Return type + +[**GetBinaryExternalsOutputBody**](GetBinaryExternalsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3GetBinaryRelated** > GetRelatedBinariesOutputBody v3GetBinaryRelated(binaryId) @@ -982,6 +1138,97 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3SearchBinaries** +> SearchBinariesOutputBody v3SearchBinaries(partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, userIds, limit, offset) + +Search binaries + +Searches for binaries visible to the caller. At least one of partial_name, partial_sha256, tags, or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.BinariesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + BinariesApi apiInstance = new BinariesApi(defaultClient); + String partialName = "partialName_example"; // String | Partial or full binary name to search for + String partialSha256 = "partialSha256_example"; // String | Partial or full SHA-256 hash to search for + List tags = Arrays.asList(); // List | Restrict results to binaries carrying at least one of these tags + String modelName = "modelName_example"; // String | Restrict results to binaries analysed with this model + Boolean userFilesOnly = false; // Boolean | Restrict results to files the caller uploaded themself + Long excludeBinaryId = 56L; // Long | A binary ID to exclude from the results + List userIds = Arrays.asList(); // List | Restrict results to binaries owned by one of these user IDs + Long limit = 10L; // Long | Maximum results to return + Long offset = 0L; // Long | Number of results to skip + try { + SearchBinariesOutputBody result = apiInstance.v3SearchBinaries(partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, userIds, limit, offset); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling BinariesApi#v3SearchBinaries"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **partialName** | **String**| Partial or full binary name to search for | [optional] | +| **partialSha256** | **String**| Partial or full SHA-256 hash to search for | [optional] | +| **tags** | [**List<String>**](String.md)| Restrict results to binaries carrying at least one of these tags | [optional] | +| **modelName** | **String**| Restrict results to binaries analysed with this model | [optional] | +| **userFilesOnly** | **Boolean**| Restrict results to files the caller uploaded themself | [optional] [default to false] | +| **excludeBinaryId** | **Long**| A binary ID to exclude from the results | [optional] | +| **userIds** | [**List<Long>**](Long.md)| Restrict results to binaries owned by one of these user IDs | [optional] | +| **limit** | **Long**| Maximum results to return | [optional] [default to 10] | +| **offset** | **Long**| Number of results to skip | [optional] [default to 0] | + +### Return type + +[**SearchBinariesOutputBody**](SearchBinariesOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3UploadFile** > UploadOutputBody v3UploadFile(_file, uploadFileType, forceOverwrite) diff --git a/docs/BinaryExternalsBody.md b/docs/BinaryExternalsBody.md new file mode 100644 index 0000000..fa5c650 --- /dev/null +++ b/docs/BinaryExternalsBody.md @@ -0,0 +1,17 @@ + + +# BinaryExternalsBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mb** | **Object** | | | +|**mbLastUpdated** | **OffsetDateTime** | When the MalwareBazaar lookup last ran, null if never looked up | | +|**sha256Hash** | **String** | SHA-256 hash the lookups were keyed by | | +|**vt** | **Object** | | | +|**vtLastUpdated** | **OffsetDateTime** | When the VirusTotal lookup last ran | | + + + diff --git a/docs/BinarySearchResultBody.md b/docs/BinarySearchResultBody.md new file mode 100644 index 0000000..0d0624e --- /dev/null +++ b/docs/BinarySearchResultBody.md @@ -0,0 +1,21 @@ + + +# BinarySearchResultBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | | | +|**binaryId** | **Long** | | | +|**binaryName** | **String** | | | +|**createdAt** | **OffsetDateTime** | | | +|**modelId** | **Long** | | | +|**modelName** | **String** | | | +|**ownedBy** | **String** | | | +|**sha256Hash** | **String** | | | +|**tags** | **List<String>** | | | + + + diff --git a/docs/BulkAddTagsInputBody.md b/docs/BulkAddTagsInputBody.md new file mode 100644 index 0000000..65dc14d --- /dev/null +++ b/docs/BulkAddTagsInputBody.md @@ -0,0 +1,14 @@ + + +# BulkAddTagsInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisIds** | **List<Long>** | IDs of the analyses to tag. The caller must own every one, or none are changed | | +|**tags** | **List<String>** | Tags to add. A binary that already carries a tag, under any origin, is left as-is for that name | | + + + diff --git a/docs/BulkAddTagsOutputBody.md b/docs/BulkAddTagsOutputBody.md new file mode 100644 index 0000000..adbb57b --- /dev/null +++ b/docs/BulkAddTagsOutputBody.md @@ -0,0 +1,13 @@ + + +# BulkAddTagsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**results** | **List<BulkAddTagsResultBody>** | One entry per requested analysis, in the order they were given | | + + + diff --git a/docs/BulkAddTagsResultBody.md b/docs/BulkAddTagsResultBody.md new file mode 100644 index 0000000..1711ad2 --- /dev/null +++ b/docs/BulkAddTagsResultBody.md @@ -0,0 +1,14 @@ + + +# BulkAddTagsResultBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**addedTags** | **List<String>** | Tags actually added; empty when the binary already carried every requested name | | +|**analysisId** | **Long** | ID of the analysis | | + + + diff --git a/docs/CollectionsApi.md b/docs/CollectionsApi.md index b09184e..1b9d9ef 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -884,11 +884,11 @@ public class Example { # **v3ListCollections** -> ListCollectionsOutputBody v3ListCollections(searchTerm, filters, limit, offset, orderBy, order) +> ListCollectionsOutputBody v3ListCollections(searchTerm, binaryName, binarySha256, tags, userIds, filters, limit, offset, orderBy, order) List collections. -Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed +Lists collections accessible to the authenticated user. Supports search by collection name, contained binary name/SHA-256, tags, owner, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed ### Example ```java @@ -916,14 +916,18 @@ public class Example { bearerAuth.setBearerToken("BEARER TOKEN"); CollectionsApi apiInstance = new CollectionsApi(defaultClient); - String searchTerm = "searchTerm_example"; // String | + String searchTerm = "searchTerm_example"; // String | Partial or full collection name to search for + String binaryName = "binaryName_example"; // String | Only return Collections containing a Binary whose name contains this + String binarySha256 = "binarySha256_example"; // String | Only return Collections containing a Binary whose SHA-256 hash contains this + List tags = Arrays.asList(); // List | Only return Collections carrying at least one of these Tags + List userIds = Arrays.asList(); // List | Restrict results to Collections owned by one of these user IDs List filters = Arrays.asList(); // List | Long limit = 20L; // Long | Long offset = 0L; // Long | String orderBy = "created"; // String | String order = "ASC"; // String | try { - ListCollectionsOutputBody result = apiInstance.v3ListCollections(searchTerm, filters, limit, offset, orderBy, order); + ListCollectionsOutputBody result = apiInstance.v3ListCollections(searchTerm, binaryName, binarySha256, tags, userIds, filters, limit, offset, orderBy, order); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling CollectionsApi#v3ListCollections"); @@ -940,7 +944,11 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **searchTerm** | **String**| | [optional] | +| **searchTerm** | **String**| Partial or full collection name to search for | [optional] | +| **binaryName** | **String**| Only return Collections containing a Binary whose name contains this | [optional] | +| **binarySha256** | **String**| Only return Collections containing a Binary whose SHA-256 hash contains this | [optional] | +| **tags** | [**List<String>**](String.md)| Only return Collections carrying at least one of these Tags | [optional] | +| **userIds** | [**List<Long>**](Long.md)| Restrict results to Collections owned by one of these user IDs | [optional] | | **filters** | [**List<String>**](String.md)| | [optional] [enum: official_only, user_only, team_only, public_only, hide_empty] | | **limit** | **Long**| | [optional] [default to 20] | | **offset** | **Long**| | [optional] [default to 0] | diff --git a/docs/CreateURLRequest.md b/docs/CreateURLRequest.md new file mode 100644 index 0000000..c082d33 --- /dev/null +++ b/docs/CreateURLRequest.md @@ -0,0 +1,25 @@ + + +# CreateURLRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisScope** | [**AnalysisScopeEnum**](#AnalysisScopeEnum) | | [optional] | +|**url** | **String** | | | + + + +## Enum: AnalysisScopeEnum + +| Name | Value | +|---- | -----| +| PRIVATE | "PRIVATE" | +| PUBLIC | "PUBLIC" | +| TEAM | "TEAM" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateURLResponse.md b/docs/CreateURLResponse.md new file mode 100644 index 0000000..7871329 --- /dev/null +++ b/docs/CreateURLResponse.md @@ -0,0 +1,15 @@ + + +# CreateURLResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | | | +|**binaryId** | **Long** | | | +|**sha256Hash** | **String** | | | + + + diff --git a/docs/CreateUserInputBody.md b/docs/CreateUserInputBody.md index 1ca3176..fc3cb45 100644 --- a/docs/CreateUserInputBody.md +++ b/docs/CreateUserInputBody.md @@ -13,6 +13,7 @@ |**lastName** | **String** | Last name | [optional] | |**password** | **String** | Initial password | | |**role** | [**RoleEnum**](#RoleEnum) | User role (defaults to USER) | [optional] | +|**teamId** | **Long** | Existing team to add the user to, which also becomes their default team | [optional] | |**tier** | [**TierEnum**](#TierEnum) | User tier (defaults to ENTHUSIAST) | [optional] | |**timeZone** | **String** | IANA time zone | [optional] | |**username** | **String** | Username | | diff --git a/docs/CryptoFinding.md b/docs/CryptoFinding.md index f4af292..e1b9fc5 100644 --- a/docs/CryptoFinding.md +++ b/docs/CryptoFinding.md @@ -17,6 +17,7 @@ |**functionName** | **String** | Name of the function the finding was reported in | | |**functionSize** | **Long** | Size of the function in bytes | | |**libraries** | [**List<LibrariesEnum>**](#List<LibrariesEnum>) | Distinct crypto libraries evidenced by this function | | +|**verification** | **CryptoVerification** | LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. | [optional] | diff --git a/docs/CryptoVerification.md b/docs/CryptoVerification.md new file mode 100644 index 0000000..8f9890a --- /dev/null +++ b/docs/CryptoVerification.md @@ -0,0 +1,26 @@ + + +# CryptoVerification + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**confidence** | [**ConfidenceEnum**](#ConfidenceEnum) | LLM's confidence in the verdict. Absent when verified is null. | [optional] | +|**reasoning** | **String** | LLM's explanation for the verdict, or the reason verification could not be completed | | +|**verified** | **Boolean** | Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped | | + + + +## Enum: ConfidenceEnum + +| Name | Value | +|---- | -----| +| HIGH | "high" | +| MEDIUM | "medium" | +| LOW | "low" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/DailyAnalysesCountOutputBody.md b/docs/DailyAnalysesCountOutputBody.md new file mode 100644 index 0000000..bbe1e7a --- /dev/null +++ b/docs/DailyAnalysesCountOutputBody.md @@ -0,0 +1,13 @@ + + +# DailyAnalysesCountOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dailyCounts** | **List<DailyCountBody>** | One entry per day of the last 31 days, oldest first | | + + + diff --git a/docs/DailyCountBody.md b/docs/DailyCountBody.md new file mode 100644 index 0000000..a784ec8 --- /dev/null +++ b/docs/DailyCountBody.md @@ -0,0 +1,14 @@ + + +# DailyCountBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**count** | **Long** | Analyses the user created that day | | +|**day** | **OffsetDateTime** | Day this count covers, at midnight UTC | | + + + diff --git a/docs/ExecutionFinding.md b/docs/ExecutionFinding.md index 94fca00..8d8b728 100644 --- a/docs/ExecutionFinding.md +++ b/docs/ExecutionFinding.md @@ -18,6 +18,7 @@ |**functionName** | **String** | Name of the function the finding was reported in | | |**functionSize** | **Long** | Size of the function in bytes | | |**sources** | [**List<SourcesEnum>**](#List<SourcesEnum>) | Distinct execution sources evidenced by this function | | +|**verification** | **ExecutionVerification** | LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. | [optional] | diff --git a/docs/ExecutionVerification.md b/docs/ExecutionVerification.md new file mode 100644 index 0000000..800607f --- /dev/null +++ b/docs/ExecutionVerification.md @@ -0,0 +1,26 @@ + + +# ExecutionVerification + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**confidence** | [**ConfidenceEnum**](#ConfidenceEnum) | LLM's confidence in the verdict. Absent when verified is null. | [optional] | +|**reasoning** | **String** | LLM's explanation for the verdict, or the reason verification could not be completed | | +|**verified** | **Boolean** | Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped | | + + + +## Enum: ConfidenceEnum + +| Name | Value | +|---- | -----| +| HIGH | "high" | +| MEDIUM | "medium" | +| LOW | "low" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/FilesystemFinding.md b/docs/FilesystemFinding.md index 0c9ef2b..05fb558 100644 --- a/docs/FilesystemFinding.md +++ b/docs/FilesystemFinding.md @@ -18,6 +18,7 @@ |**functionSize** | **Long** | Size of the function in bytes | | |**modifies** | **Boolean** | Whether this function evidences modifying the filesystem rather than only observing it | | |**sources** | [**List<SourcesEnum>**](#List<SourcesEnum>) | Distinct filesystem sources evidenced by this function | | +|**verification** | **FilesystemVerification** | LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. | [optional] | diff --git a/docs/FilesystemVerification.md b/docs/FilesystemVerification.md new file mode 100644 index 0000000..4c2b9ad --- /dev/null +++ b/docs/FilesystemVerification.md @@ -0,0 +1,26 @@ + + +# FilesystemVerification + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**confidence** | [**ConfidenceEnum**](#ConfidenceEnum) | LLM's confidence in the verdict. Absent when verified is null. | [optional] | +|**reasoning** | **String** | LLM's explanation for the verdict, or the reason verification could not be completed | | +|**verified** | **Boolean** | Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped | | + + + +## Enum: ConfidenceEnum + +| Name | Value | +|---- | -----| +| HIGH | "high" | +| MEDIUM | "medium" | +| LOW | "low" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/FunctionSearchResultBody.md b/docs/FunctionSearchResultBody.md new file mode 100644 index 0000000..dfc11c3 --- /dev/null +++ b/docs/FunctionSearchResultBody.md @@ -0,0 +1,19 @@ + + +# FunctionSearchResultBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaryName** | **String** | | | +|**createdAt** | **OffsetDateTime** | | | +|**functionId** | **Long** | | | +|**functionName** | **String** | | | +|**modelId** | **Long** | | | +|**modelName** | **String** | | | +|**ownedBy** | **String** | | | + + + diff --git a/docs/FunctionsAiDecompilationApi.md b/docs/FunctionsAiDecompilationApi.md index 8b03205..c94afe7 100644 --- a/docs/FunctionsAiDecompilationApi.md +++ b/docs/FunctionsAiDecompilationApi.md @@ -18,6 +18,7 @@ All URIs are relative to *https://api.reveng.ai* | [**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) | | [**upsertAiDecompilationRating**](FunctionsAiDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation | +| [**v3AcceptAiDecompilationTypeSuggestions**](FunctionsAiDecompilationApi.md#v3AcceptAiDecompilationTypeSuggestions) | **POST** /v3/functions/{function_id}/ai-decompilation/type-suggestions/accept | Accept AI decompilation type suggestions | | [**v3GetAiDecompilationLineAttributions**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationLineAttributions) | **GET** /v3/functions/{function_id}/ai-decompilation/line-attributions | Get AI decompilation line attributions | | [**v3GetAiDecompilationTokens**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides | | [**v3GetAiDecompilationTypeSuggestions**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestions) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Get AI decompilation type suggestions | @@ -1104,6 +1105,87 @@ public class Example { | **201** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **v3AcceptAiDecompilationTypeSuggestions** +> AcceptTypeSuggestionsOutputBody v3AcceptAiDecompilationTypeSuggestions(functionId, acceptTypeSuggestionsInputBody) + +Accept AI decompilation type suggestions + +Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.FunctionsAiDecompilationApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); + Long functionId = 56L; // Long | Function ID + AcceptTypeSuggestionsInputBody acceptTypeSuggestionsInputBody = new AcceptTypeSuggestionsInputBody(); // AcceptTypeSuggestionsInputBody | + try { + AcceptTypeSuggestionsOutputBody result = apiInstance.v3AcceptAiDecompilationTypeSuggestions(functionId, acceptTypeSuggestionsInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3AcceptAiDecompilationTypeSuggestions"); + 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 | | +| **acceptTypeSuggestionsInputBody** | [**AcceptTypeSuggestionsInputBody**](AcceptTypeSuggestionsInputBody.md)| | | + +### Return type + +[**AcceptTypeSuggestionsOutputBody**](AcceptTypeSuggestionsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + # **v3GetAiDecompilationLineAttributions** > LineAttributionsData v3GetAiDecompilationLineAttributions(functionId) diff --git a/docs/FunctionsCoreApi.md b/docs/FunctionsCoreApi.md index af6f8af..a43af2d 100644 --- a/docs/FunctionsCoreApi.md +++ b/docs/FunctionsCoreApi.md @@ -28,6 +28,7 @@ All URIs are relative to *https://api.reveng.ai* | [**listImportedFunctions**](FunctionsCoreApi.md#listImportedFunctions) | **GET** /v3/analyses/{analysis_id}/imported-functions | List imported functions in an analysis | | [**startFunctionsMatching**](FunctionsCoreApi.md#startFunctionsMatching) | **POST** /v3/functions/matches | Start function matching for an explicit set of functions | | [**v3CanonicalizeFunctionNames**](FunctionsCoreApi.md#v3CanonicalizeFunctionNames) | **POST** /v3/functions/canonical-names | Canonicalize a batch of function names | +| [**v3SearchFunctions**](FunctionsCoreApi.md#v3SearchFunctions) | **GET** /v3/functions | Search functions | @@ -1896,3 +1897,84 @@ public class Example { | **500** | Internal Server Error | - | | **503** | Service Unavailable | - | + +# **v3SearchFunctions** +> SearchFunctionsOutputBody v3SearchFunctions(partialName, modelName, limit, offset) + +Search functions + +Searches for functions visible to the caller. At least one of partial_name or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.FunctionsCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + FunctionsCoreApi apiInstance = new FunctionsCoreApi(defaultClient); + String partialName = "partialName_example"; // String | Partial or full function name to search for + String modelName = "modelName_example"; // String | Restrict results to functions analysed with this model + Long limit = 10L; // Long | Maximum results to return + Long offset = 0L; // Long | Number of results to skip + try { + SearchFunctionsOutputBody result = apiInstance.v3SearchFunctions(partialName, modelName, limit, offset); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsCoreApi#v3SearchFunctions"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **partialName** | **String**| Partial or full function name to search for | [optional] | +| **modelName** | **String**| Restrict results to functions analysed with this model | [optional] | +| **limit** | **Long**| Maximum results to return | [optional] [default to 10] | +| **offset** | **Long**| Number of results to skip | [optional] [default to 0] | + +### Return type + +[**SearchFunctionsOutputBody**](SearchFunctionsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/GetBinaryExternalsOutputBody.md b/docs/GetBinaryExternalsOutputBody.md new file mode 100644 index 0000000..a55bad7 --- /dev/null +++ b/docs/GetBinaryExternalsOutputBody.md @@ -0,0 +1,14 @@ + + +# GetBinaryExternalsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**binaryId** | **Long** | | | +|**externals** | **BinaryExternalsBody** | Null until at least one external lookup has run for this binary's content hash | | + + + diff --git a/docs/GetTokensResponse.md b/docs/GetTokensResponse.md index 6ebcd3f..464c0c4 100644 --- a/docs/GetTokensResponse.md +++ b/docs/GetTokensResponse.md @@ -10,7 +10,7 @@ |**aiDecomp** | **String** | Tokenised AI-decompilation. Includes generated comments. Empty until a run has succeeded. | | |**analysisId** | **Long** | Analysis the function belongs to. Scopes every data_type_id below. | | |**placeholderToRenderedToken** | **Map<String, RenderedToken>** | Each placeholder token mapped to the value the server would render in its place, and the record it refers to. Null until a run has succeeded. | | -|**placeholderToUserOverride** | **Map<String, Token>** | The caller's own overrides, keyed by token. Null until a run has succeeded. | | +|**placeholderToUserOverride** | **Map<String, Token>** | The overrides on this function, keyed by token, each carrying who chose it. Null until a run has succeeded. | | diff --git a/docs/NetworkingFinding.md b/docs/NetworkingFinding.md index acf3fd2..917cc85 100644 --- a/docs/NetworkingFinding.md +++ b/docs/NetworkingFinding.md @@ -18,6 +18,7 @@ |**networkCalls** | **List<NetworkingCall>** | Matches against names this function calls | [optional] | |**remote** | **Boolean** | Whether this function evidences remote communication rather than only supporting it | | |**sources** | [**List<SourcesEnum>**](#List<SourcesEnum>) | Distinct networking sources evidenced by this function | | +|**verification** | **NetworkingVerification** | LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. | [optional] | diff --git a/docs/NetworkingVerification.md b/docs/NetworkingVerification.md new file mode 100644 index 0000000..08bc40f --- /dev/null +++ b/docs/NetworkingVerification.md @@ -0,0 +1,26 @@ + + +# NetworkingVerification + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**confidence** | [**ConfidenceEnum**](#ConfidenceEnum) | LLM's confidence in the verdict. Absent when verified is null. | [optional] | +|**reasoning** | **String** | LLM's explanation for the verdict, or the reason verification could not be completed | | +|**verified** | **Boolean** | Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped | | + + + +## Enum: ConfidenceEnum + +| Name | Value | +|---- | -----| +| HIGH | "high" | +| MEDIUM | "medium" | +| LOW | "low" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ReportAnalysisBody.md b/docs/ReportAnalysisBody.md new file mode 100644 index 0000000..6dfc45b --- /dev/null +++ b/docs/ReportAnalysisBody.md @@ -0,0 +1,14 @@ + + +# ReportAnalysisBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**completed** | **Long** | REPORT_ANALYSIS agent tasks completed that day | | +|**softwareTypes** | **SoftwareTypeCountsBody** | Breakdown of completed reports by the software type the agent classified | | + + + diff --git a/docs/SearchBinariesOutputBody.md b/docs/SearchBinariesOutputBody.md new file mode 100644 index 0000000..0d9582b --- /dev/null +++ b/docs/SearchBinariesOutputBody.md @@ -0,0 +1,16 @@ + + +# SearchBinariesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasNextPage** | **Boolean** | | | +|**pageNumber** | **Long** | | | +|**pageSize** | **Long** | | | +|**results** | **List<BinarySearchResultBody>** | | | + + + diff --git a/docs/SearchFunctionsOutputBody.md b/docs/SearchFunctionsOutputBody.md new file mode 100644 index 0000000..8cb0af0 --- /dev/null +++ b/docs/SearchFunctionsOutputBody.md @@ -0,0 +1,16 @@ + + +# SearchFunctionsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasNextPage** | **Boolean** | | | +|**pageNumber** | **Long** | | | +|**pageSize** | **Long** | | | +|**results** | **List<FunctionSearchResultBody>** | | | + + + diff --git a/docs/SearchTagsOutputBody.md b/docs/SearchTagsOutputBody.md new file mode 100644 index 0000000..31c9969 --- /dev/null +++ b/docs/SearchTagsOutputBody.md @@ -0,0 +1,16 @@ + + +# SearchTagsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**hasNextPage** | **Boolean** | | | +|**pageNumber** | **Long** | | | +|**pageSize** | **Long** | | | +|**results** | **List<TagSearchResultBody>** | | | + + + diff --git a/docs/SoftwareTypeCountsBody.md b/docs/SoftwareTypeCountsBody.md new file mode 100644 index 0000000..97be9ab --- /dev/null +++ b/docs/SoftwareTypeCountsBody.md @@ -0,0 +1,17 @@ + + +# SoftwareTypeCountsBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**benign** | **Long** | Reports classifying the software as benign | | +|**legitimate** | **Long** | Reports classifying the software as legitimate | | +|**legitimateSoftwareBackdoor** | **Long** | Reports classifying the software as a legitimate backdoor | | +|**malicious** | **Long** | Reports classifying the software as malicious | | +|**potentiallyUnwantedApplication** | **Long** | Reports classifying the software as a potentially unwanted application | | + + + diff --git a/docs/TagSearchResultBody.md b/docs/TagSearchResultBody.md new file mode 100644 index 0000000..f3c3d91 --- /dev/null +++ b/docs/TagSearchResultBody.md @@ -0,0 +1,14 @@ + + +# TagSearchResultBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tag** | **String** | | | +|**tagId** | **Long** | | | + + + diff --git a/docs/Token.md b/docs/Token.md index 21d593b..0704aa2 100644 --- a/docs/Token.md +++ b/docs/Token.md @@ -7,7 +7,18 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**source** | [**SourceEnum**](#SourceEnum) | Who chose this override. Response only; ignored in a request. | [optional] | |**value** | **String** | Name the token resolves to. An empty string in a request removes the override. | | +## Enum: SourceEnum + +| Name | Value | +|---- | -----| +| USER | "user" | +| LLM | "llm" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateTagsInputBody.md b/docs/UpdateTagsInputBody.md new file mode 100644 index 0000000..b92da7e --- /dev/null +++ b/docs/UpdateTagsInputBody.md @@ -0,0 +1,13 @@ + + +# UpdateTagsInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tags** | **List<String>** | The complete set of user tags the analysis' binary should carry after this call | | + + + diff --git a/docs/UpsertOverridesData.md b/docs/UpsertOverridesData.md index 9fbffb1..2d79f87 100644 --- a/docs/UpsertOverridesData.md +++ b/docs/UpsertOverridesData.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**placeholderToUserOverride** | **Map<String, Token>** | Every override on the function after applying this request, keyed by placeholder token. | | +|**placeholderToUserOverride** | **Map<String, Token>** | Every override on the function after applying this request, keyed by placeholder token, each carrying who chose it. | | diff --git a/docs/WorkflowDayBody.md b/docs/WorkflowDayBody.md new file mode 100644 index 0000000..a7841fc --- /dev/null +++ b/docs/WorkflowDayBody.md @@ -0,0 +1,15 @@ + + +# WorkflowDayBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analyseCapabilities** | **AnalyseCapabilitiesBody** | ANALYSE_CAPABILITIES agent-task stats for the day | | +|**date** | **String** | Day this entry covers | | +|**reportAnalysis** | **ReportAnalysisBody** | REPORT_ANALYSIS agent-task stats for the day | | + + + diff --git a/docs/XrefFromBody.md b/docs/XrefFromBody.md new file mode 100644 index 0000000..5c02ffb --- /dev/null +++ b/docs/XrefFromBody.md @@ -0,0 +1,21 @@ + + +# XrefFromBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**isCall** | **Boolean** | True when the xref is a call instruction | | +|**isData** | **Boolean** | True when the xref targets data rather than code | | +|**isScalar** | **Boolean** | True when the xref is a scalar constant | | +|**isString** | **Boolean** | True when the xref targets a string | | +|**origStrEncoding** | **String** | String encoding, set only when is_string is true | [optional] | +|**rawData** | **String** | Raw bytes at the xref target, when captured | [optional] | +|**segment** | **XrefSegmentBody** | Memory segment the xref target sits in | [optional] | +|**value** | **String** | The xref's resolved value, when the sequencer could determine one | [optional] | +|**xrefTo** | **Long** | Address the reference targets | | + + + diff --git a/docs/XrefIntoBody.md b/docs/XrefIntoBody.md new file mode 100644 index 0000000..d9a8ad8 --- /dev/null +++ b/docs/XrefIntoBody.md @@ -0,0 +1,21 @@ + + +# XrefIntoBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**isCall** | **Boolean** | True when the xref is a call instruction | | +|**isData** | **Boolean** | True when the xref targets data rather than code | | +|**isScalar** | **Boolean** | True when the xref is a scalar constant | | +|**isString** | **Boolean** | True when the xref targets a string | | +|**origStrEncoding** | **String** | String encoding, set only when is_string is true | [optional] | +|**rawData** | **String** | Raw bytes at the xref target, when captured | [optional] | +|**segment** | **XrefSegmentBody** | Memory segment the xref target sits in | [optional] | +|**value** | **String** | The xref's resolved value, when the sequencer could determine one | [optional] | +|**xrefFrom** | **Long** | Address the reference originates from | | + + + diff --git a/docs/XrefSegmentBody.md b/docs/XrefSegmentBody.md new file mode 100644 index 0000000..8674625 --- /dev/null +++ b/docs/XrefSegmentBody.md @@ -0,0 +1,30 @@ + + +# XrefSegmentBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**end** | **Long** | End address of the segment, inclusive | | +|**exec** | **Boolean** | True when the segment is executable | | +|**kind** | [**KindEnum**](#KindEnum) | Coarse classification of the segment | | +|**name** | **String** | Segment name | | +|**read** | **Boolean** | True when the segment is readable | | +|**start** | **Long** | Start address of the segment | | +|**write** | **Boolean** | True when the segment is writable | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| CODE | "code" | +| DATA | "data" | +| OTHER | "other" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/pom.xml b/pom.xml index c6c3db1..c6e4f5b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 4.54.0 + 4.60.1 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesBulkActionsApi.java b/src/main/java/ai/reveng/api/AnalysesBulkActionsApi.java index 1894b1b..18be653 100644 --- a/src/main/java/ai/reveng/api/AnalysesBulkActionsApi.java +++ b/src/main/java/ai/reveng/api/AnalysesBulkActionsApi.java @@ -31,6 +31,8 @@ import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseAnalysisBulkAddTagsResponse; import ai.reveng.model.BaseResponseDict; +import ai.reveng.model.BulkAddTagsInputBody; +import ai.reveng.model.BulkAddTagsOutputBody; import ai.reveng.model.BulkDeleteAnalysesInputBody; import ai.reveng.model.BulkDeleteAnalysesRequest; @@ -223,7 +225,9 @@ public okhttp3.Call bulkAddAnalysisTagsAsync(@javax.annotation.Nonnull AnalysisB 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public okhttp3.Call bulkDeleteAnalysesCall(@javax.annotation.Nonnull BulkDeleteAnalysesRequest bulkDeleteAnalysesRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -269,6 +273,7 @@ public okhttp3.Call bulkDeleteAnalysesCall(@javax.annotation.Nonnull BulkDeleteA return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call bulkDeleteAnalysesValidateBeforeCall(@javax.annotation.Nonnull BulkDeleteAnalysesRequest bulkDeleteAnalysesRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'bulkDeleteAnalysesRequest' is set @@ -295,7 +300,9 @@ private okhttp3.Call bulkDeleteAnalysesValidateBeforeCall(@javax.annotation.Nonn 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public BaseResponseDict bulkDeleteAnalyses(@javax.annotation.Nonnull BulkDeleteAnalysesRequest bulkDeleteAnalysesRequest) throws ApiException { ApiResponse localVarResp = bulkDeleteAnalysesWithHttpInfo(bulkDeleteAnalysesRequest); return localVarResp.getData(); @@ -316,7 +323,9 @@ public BaseResponseDict bulkDeleteAnalyses(@javax.annotation.Nonnull BulkDeleteA 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public ApiResponse bulkDeleteAnalysesWithHttpInfo(@javax.annotation.Nonnull BulkDeleteAnalysesRequest bulkDeleteAnalysesRequest) throws ApiException { okhttp3.Call localVarCall = bulkDeleteAnalysesValidateBeforeCall(bulkDeleteAnalysesRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -339,7 +348,9 @@ public ApiResponse bulkDeleteAnalysesWithHttpInfo(@javax.annot 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public okhttp3.Call bulkDeleteAnalysesAsync(@javax.annotation.Nonnull BulkDeleteAnalysesRequest bulkDeleteAnalysesRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = bulkDeleteAnalysesValidateBeforeCall(bulkDeleteAnalysesRequest, _callback); @@ -347,6 +358,149 @@ public okhttp3.Call bulkDeleteAnalysesAsync(@javax.annotation.Nonnull BulkDelete localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3BatchAddAnalysisTags + * @param bulkAddTagsInputBody (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3BatchAddAnalysisTagsCall(@javax.annotation.Nonnull BulkAddTagsInputBody bulkAddTagsInputBody, 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 = bulkAddTagsInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses:batchAddTags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3BatchAddAnalysisTagsValidateBeforeCall(@javax.annotation.Nonnull BulkAddTagsInputBody bulkAddTagsInputBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'bulkAddTagsInputBody' is set + if (bulkAddTagsInputBody == null) { + throw new ApiException("Missing the required parameter 'bulkAddTagsInputBody' when calling v3BatchAddAnalysisTags(Async)"); + } + + return v3BatchAddAnalysisTagsCall(bulkAddTagsInputBody, _callback); + + } + + /** + * Add tags to multiple analyses. + * Adds tags (origin RevEng) to every given analysis' binary. The caller must own every analysis, or none are changed. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param bulkAddTagsInputBody (required) + * @return BulkAddTagsOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public BulkAddTagsOutputBody v3BatchAddAnalysisTags(@javax.annotation.Nonnull BulkAddTagsInputBody bulkAddTagsInputBody) throws ApiException { + ApiResponse localVarResp = v3BatchAddAnalysisTagsWithHttpInfo(bulkAddTagsInputBody); + return localVarResp.getData(); + } + + /** + * Add tags to multiple analyses. + * Adds tags (origin RevEng) to every given analysis' binary. The caller must own every analysis, or none are changed. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param bulkAddTagsInputBody (required) + * @return ApiResponse<BulkAddTagsOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3BatchAddAnalysisTagsWithHttpInfo(@javax.annotation.Nonnull BulkAddTagsInputBody bulkAddTagsInputBody) throws ApiException { + okhttp3.Call localVarCall = v3BatchAddAnalysisTagsValidateBeforeCall(bulkAddTagsInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Add tags to multiple analyses. (asynchronously) + * Adds tags (origin RevEng) to every given analysis' binary. The caller must own every analysis, or none are changed. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param bulkAddTagsInputBody (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3BatchAddAnalysisTagsAsync(@javax.annotation.Nonnull BulkAddTagsInputBody bulkAddTagsInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3BatchAddAnalysisTagsValidateBeforeCall(bulkAddTagsInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3BatchDeleteAnalyses * @param bulkDeleteAnalysesInputBody (required) diff --git a/src/main/java/ai/reveng/api/AnalysesCommentsApi.java b/src/main/java/ai/reveng/api/AnalysesCommentsApi.java index 1cd6414..2a503e8 100644 --- a/src/main/java/ai/reveng/api/AnalysesCommentsApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCommentsApi.java @@ -91,7 +91,9 @@ public void setCustomBaseUrl(String customBaseUrl) { 422 Invalid request parameters - 400 Bad Request - + * @deprecated */ + @Deprecated public okhttp3.Call createAnalysisCommentCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentBase commentBase, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -138,6 +140,7 @@ public okhttp3.Call createAnalysisCommentCall(@javax.annotation.Nonnull Integer return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call createAnalysisCommentValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentBase commentBase, final ApiCallback _callback) throws ApiException { // verify the required parameter 'analysisId' is set @@ -169,7 +172,9 @@ private okhttp3.Call createAnalysisCommentValidateBeforeCall(@javax.annotation.N 422 Invalid request parameters - 400 Bad Request - + * @deprecated */ + @Deprecated public BaseResponseCommentResponse createAnalysisComment(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentBase commentBase) throws ApiException { ApiResponse localVarResp = createAnalysisCommentWithHttpInfo(analysisId, commentBase); return localVarResp.getData(); @@ -190,7 +195,9 @@ public BaseResponseCommentResponse createAnalysisComment(@javax.annotation.Nonnu 422 Invalid request parameters - 400 Bad Request - + * @deprecated */ + @Deprecated public ApiResponse createAnalysisCommentWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentBase commentBase) throws ApiException { okhttp3.Call localVarCall = createAnalysisCommentValidateBeforeCall(analysisId, commentBase, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -213,7 +220,9 @@ public ApiResponse createAnalysisCommentWithHttpInf 422 Invalid request parameters - 400 Bad Request - + * @deprecated */ + @Deprecated public okhttp3.Call createAnalysisCommentAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentBase commentBase, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = createAnalysisCommentValidateBeforeCall(analysisId, commentBase, _callback); @@ -237,7 +246,9 @@ public okhttp3.Call createAnalysisCommentAsync(@javax.annotation.Nonnull Integer 403 You can only delete your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public okhttp3.Call deleteAnalysisCommentCall(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -284,6 +295,7 @@ public okhttp3.Call deleteAnalysisCommentCall(@javax.annotation.Nonnull Integer return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call deleteAnalysisCommentValidateBeforeCall(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'commentId' is set @@ -316,7 +328,9 @@ private okhttp3.Call deleteAnalysisCommentValidateBeforeCall(@javax.annotation.N 403 You can only delete your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public BaseResponseBool deleteAnalysisComment(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId) throws ApiException { ApiResponse localVarResp = deleteAnalysisCommentWithHttpInfo(commentId, analysisId); return localVarResp.getData(); @@ -338,7 +352,9 @@ public BaseResponseBool deleteAnalysisComment(@javax.annotation.Nonnull Integer 403 You can only delete your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public ApiResponse deleteAnalysisCommentWithHttpInfo(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId) throws ApiException { okhttp3.Call localVarCall = deleteAnalysisCommentValidateBeforeCall(commentId, analysisId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -362,7 +378,9 @@ public ApiResponse deleteAnalysisCommentWithHttpInfo(@javax.an 403 You can only delete your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public okhttp3.Call deleteAnalysisCommentAsync(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteAnalysisCommentValidateBeforeCall(commentId, analysisId, _callback); @@ -383,7 +401,9 @@ public okhttp3.Call deleteAnalysisCommentAsync(@javax.annotation.Nonnull Integer 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getAnalysisCommentsCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -429,6 +449,7 @@ public okhttp3.Call getAnalysisCommentsCall(@javax.annotation.Nonnull Integer an return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getAnalysisCommentsValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'analysisId' is set @@ -453,7 +474,9 @@ private okhttp3.Call getAnalysisCommentsValidateBeforeCall(@javax.annotation.Non 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseListCommentResponse getAnalysisComments(@javax.annotation.Nonnull Integer analysisId) throws ApiException { ApiResponse localVarResp = getAnalysisCommentsWithHttpInfo(analysisId); return localVarResp.getData(); @@ -472,7 +495,9 @@ public BaseResponseListCommentResponse getAnalysisComments(@javax.annotation.Non 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse getAnalysisCommentsWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { okhttp3.Call localVarCall = getAnalysisCommentsValidateBeforeCall(analysisId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -493,7 +518,9 @@ public ApiResponse getAnalysisCommentsWithHttpI 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getAnalysisCommentsAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getAnalysisCommentsValidateBeforeCall(analysisId, _callback); @@ -518,7 +545,9 @@ public okhttp3.Call getAnalysisCommentsAsync(@javax.annotation.Nonnull Integer a 403 You can only update your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public okhttp3.Call updateAnalysisCommentCall(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentUpdateRequest commentUpdateRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -566,6 +595,7 @@ public okhttp3.Call updateAnalysisCommentCall(@javax.annotation.Nonnull Integer return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call updateAnalysisCommentValidateBeforeCall(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentUpdateRequest commentUpdateRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'commentId' is set @@ -604,7 +634,9 @@ private okhttp3.Call updateAnalysisCommentValidateBeforeCall(@javax.annotation.N 403 You can only update your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public BaseResponseCommentResponse updateAnalysisComment(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentUpdateRequest commentUpdateRequest) throws ApiException { ApiResponse localVarResp = updateAnalysisCommentWithHttpInfo(commentId, analysisId, commentUpdateRequest); return localVarResp.getData(); @@ -627,7 +659,9 @@ public BaseResponseCommentResponse updateAnalysisComment(@javax.annotation.Nonnu 403 You can only update your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public ApiResponse updateAnalysisCommentWithHttpInfo(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentUpdateRequest commentUpdateRequest) throws ApiException { okhttp3.Call localVarCall = updateAnalysisCommentValidateBeforeCall(commentId, analysisId, commentUpdateRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -652,7 +686,9 @@ public ApiResponse updateAnalysisCommentWithHttpInf 403 You can only update your own comments - 400 Bad Request - + * @deprecated */ + @Deprecated public okhttp3.Call updateAnalysisCommentAsync(@javax.annotation.Nonnull Integer commentId, @javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull CommentUpdateRequest commentUpdateRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = updateAnalysisCommentValidateBeforeCall(commentId, analysisId, commentUpdateRequest, _callback); diff --git a/src/main/java/ai/reveng/api/AnalysesCoreApi.java b/src/main/java/ai/reveng/api/AnalysesCoreApi.java index d2c9f4e..b5ee627 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -32,6 +32,7 @@ import ai.reveng.model.AnalysisCreateRequest; import ai.reveng.model.AnalysisDetailOutputBody; import ai.reveng.model.AnalysisReport; +import ai.reveng.model.AnalysisTagsOutputBody; import ai.reveng.model.AnalysisUpdateRequest; import ai.reveng.model.AnalysisUpdateTagsRequest; import ai.reveng.model.AppApiRestV2AnalysesEnumsOrderBy; @@ -69,10 +70,12 @@ import ai.reveng.model.Order; import ai.reveng.model.PutAnalysisStringsRequest; import ai.reveng.model.ReAnalysisForm; +import ai.reveng.model.SearchTagsOutputBody; import ai.reveng.model.StartMatchingForAnalysisInputBody; import ai.reveng.model.StartMatchingOutputBody; import ai.reveng.model.StatusInput; import ai.reveng.model.UpdateAnalysisInputBody; +import ai.reveng.model.UpdateTagsInputBody; import ai.reveng.model.UpgradeAnalysisModelOutputBody; import ai.reveng.model.UploadFileType; import ai.reveng.model.Workspace; @@ -445,7 +448,9 @@ public okhttp3.Call createAnalysisAsync(@javax.annotation.Nonnull AnalysisCreate 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public okhttp3.Call deleteAnalysisCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -491,6 +496,7 @@ public okhttp3.Call deleteAnalysisCall(@javax.annotation.Nonnull Integer analysi return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call deleteAnalysisValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'analysisId' is set @@ -517,7 +523,9 @@ private okhttp3.Call deleteAnalysisValidateBeforeCall(@javax.annotation.Nonnull 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public BaseResponseDict deleteAnalysis(@javax.annotation.Nonnull Integer analysisId) throws ApiException { ApiResponse localVarResp = deleteAnalysisWithHttpInfo(analysisId); return localVarResp.getData(); @@ -538,7 +546,9 @@ public BaseResponseDict deleteAnalysis(@javax.annotation.Nonnull Integer analysi 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public ApiResponse deleteAnalysisWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { okhttp3.Call localVarCall = deleteAnalysisValidateBeforeCall(analysisId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -561,7 +571,9 @@ public ApiResponse deleteAnalysisWithHttpInfo(@javax.annotatio 404 Not Found - 403 Forbidden - + * @deprecated */ + @Deprecated public okhttp3.Call deleteAnalysisAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteAnalysisValidateBeforeCall(analysisId, _callback); @@ -2518,7 +2530,9 @@ public okhttp3.Call listAnalysesAsync(@javax.annotation.Nullable String searchTe 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call lookupBinaryIdCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -2564,6 +2578,7 @@ public okhttp3.Call lookupBinaryIdCall(@javax.annotation.Nonnull Integer binaryI return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call lookupBinaryIdValidateBeforeCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'binaryId' is set @@ -2588,7 +2603,9 @@ private okhttp3.Call lookupBinaryIdValidateBeforeCall(@javax.annotation.Nonnull 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public Object lookupBinaryId(@javax.annotation.Nonnull Integer binaryId) throws ApiException { ApiResponse localVarResp = lookupBinaryIdWithHttpInfo(binaryId); return localVarResp.getData(); @@ -2607,7 +2624,9 @@ public Object lookupBinaryId(@javax.annotation.Nonnull Integer binaryId) throws 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse lookupBinaryIdWithHttpInfo(@javax.annotation.Nonnull Integer binaryId) throws ApiException { okhttp3.Call localVarCall = lookupBinaryIdValidateBeforeCall(binaryId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -2628,7 +2647,9 @@ public ApiResponse lookupBinaryIdWithHttpInfo(@javax.annotation.Nonnull 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call lookupBinaryIdAsync(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = lookupBinaryIdValidateBeforeCall(binaryId, _callback); @@ -3115,7 +3136,9 @@ public okhttp3.Call startAnalysisFunctionMatchingAsync(@javax.annotation.Nonnull 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call updateAnalysisCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull AnalysisUpdateRequest analysisUpdateRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -3162,6 +3185,7 @@ public okhttp3.Call updateAnalysisCall(@javax.annotation.Nonnull Integer analysi return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call updateAnalysisValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull AnalysisUpdateRequest analysisUpdateRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'analysisId' is set @@ -3192,7 +3216,9 @@ private okhttp3.Call updateAnalysisValidateBeforeCall(@javax.annotation.Nonnull 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseAnalysisDetailResponse updateAnalysis(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull AnalysisUpdateRequest analysisUpdateRequest) throws ApiException { ApiResponse localVarResp = updateAnalysisWithHttpInfo(analysisId, analysisUpdateRequest); return localVarResp.getData(); @@ -3212,7 +3238,9 @@ public BaseResponseAnalysisDetailResponse updateAnalysis(@javax.annotation.Nonnu 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse updateAnalysisWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull AnalysisUpdateRequest analysisUpdateRequest) throws ApiException { okhttp3.Call localVarCall = updateAnalysisValidateBeforeCall(analysisId, analysisUpdateRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -3234,7 +3262,9 @@ public ApiResponse updateAnalysisWithHttpInf 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call updateAnalysisAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull AnalysisUpdateRequest analysisUpdateRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = updateAnalysisValidateBeforeCall(analysisId, analysisUpdateRequest, _callback); @@ -5846,6 +5876,155 @@ public okhttp3.Call v3QueueBinaryExportAsync(@javax.annotation.Nonnull Long anal localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3SearchTags + * @param partialName Partial or full tag name to search for, at least 3 characters (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SearchTagsCall(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, 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/tags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (partialName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("partial_name", partialName)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3SearchTagsValidateBeforeCall(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + return v3SearchTagsCall(partialName, limit, offset, _callback); + + } + + /** + * Search tags + * Searches for tags by name. partial_name is required and must be at least 3 characters. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full tag name to search for, at least 3 characters (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @return SearchTagsOutputBody + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public SearchTagsOutputBody v3SearchTags(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset) throws ApiException { + ApiResponse localVarResp = v3SearchTagsWithHttpInfo(partialName, limit, offset); + return localVarResp.getData(); + } + + /** + * Search tags + * Searches for tags by name. partial_name is required and must be at least 3 characters. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full tag name to search for, at least 3 characters (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @return ApiResponse<SearchTagsOutputBody> + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3SearchTagsWithHttpInfo(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset) throws ApiException { + okhttp3.Call localVarCall = v3SearchTagsValidateBeforeCall(partialName, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Search tags (asynchronously) + * Searches for tags by name. partial_name is required and must be at least 3 characters. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full tag name to search for, at least 3 characters (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SearchTagsAsync(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3SearchTagsValidateBeforeCall(partialName, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3UpdateAnalysis * @param analysisId Analysis ID (required) @@ -6003,6 +6182,159 @@ public okhttp3.Call v3UpdateAnalysisAsync(@javax.annotation.Nonnull Long analysi localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3UpdateAnalysisTags + * @param analysisId Analysis ID (required) + * @param updateTagsInputBody (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpdateAnalysisTagsCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateTagsInputBody updateTagsInputBody, 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 = updateTagsInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/tags" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3UpdateAnalysisTagsValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateTagsInputBody updateTagsInputBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling v3UpdateAnalysisTags(Async)"); + } + + // verify the required parameter 'updateTagsInputBody' is set + if (updateTagsInputBody == null) { + throw new ApiException("Missing the required parameter 'updateTagsInputBody' when calling v3UpdateAnalysisTags(Async)"); + } + + return v3UpdateAnalysisTagsCall(analysisId, updateTagsInputBody, _callback); + + } + + /** + * Replace an analysis' tags. + * Replaces the analysis' binary's user tags (origin RevEng) with the given set. A tag recorded under any other origin, such as a heuristic detection sharing a name with a user tag, is left in place even when its name is absent from the request. Only the owner may call it. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param updateTagsInputBody (required) + * @return AnalysisTagsOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public AnalysisTagsOutputBody v3UpdateAnalysisTags(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateTagsInputBody updateTagsInputBody) throws ApiException { + ApiResponse localVarResp = v3UpdateAnalysisTagsWithHttpInfo(analysisId, updateTagsInputBody); + return localVarResp.getData(); + } + + /** + * Replace an analysis' tags. + * Replaces the analysis' binary's user tags (origin RevEng) with the given set. A tag recorded under any other origin, such as a heuristic detection sharing a name with a user tag, is left in place even when its name is absent from the request. Only the owner may call it. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param updateTagsInputBody (required) + * @return ApiResponse<AnalysisTagsOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3UpdateAnalysisTagsWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateTagsInputBody updateTagsInputBody) throws ApiException { + okhttp3.Call localVarCall = v3UpdateAnalysisTagsValidateBeforeCall(analysisId, updateTagsInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Replace an analysis' tags. (asynchronously) + * Replaces the analysis' binary's user tags (origin RevEng) with the given set. A tag recorded under any other origin, such as a heuristic detection sharing a name with a user tag, is left in place even when its name is absent from the request. Only the owner may call it. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param updateTagsInputBody (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpdateAnalysisTagsAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateTagsInputBody updateTagsInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3UpdateAnalysisTagsValidateBeforeCall(analysisId, updateTagsInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3UpgradeAnalysisModel * @param analysisId Analysis ID (required) diff --git a/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java b/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java index b8589cc..e567f62 100644 --- a/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java +++ b/src/main/java/ai/reveng/api/AnalysesResultsMetadataApi.java @@ -28,6 +28,8 @@ import ai.reveng.model.APIError; import ai.reveng.model.AnalysisCapabilitiesOutputBody; +import ai.reveng.model.AnalysisTagsOutputBody; +import ai.reveng.model.AnalysisXrefOutputBody; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseAnalysisFunctions; import ai.reveng.model.BaseResponseAnalysisFunctionsList; @@ -246,7 +248,9 @@ public okhttp3.Call getAnalysisFunctionsPaginatedAsync(@javax.annotation.Nonnull 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getCapabilitiesCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -292,6 +296,7 @@ public okhttp3.Call getCapabilitiesCall(@javax.annotation.Nonnull Integer analys return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getCapabilitiesValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'analysisId' is set @@ -316,7 +321,9 @@ private okhttp3.Call getCapabilitiesValidateBeforeCall(@javax.annotation.Nonnull 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseCapabilities getCapabilities(@javax.annotation.Nonnull Integer analysisId) throws ApiException { ApiResponse localVarResp = getCapabilitiesWithHttpInfo(analysisId); return localVarResp.getData(); @@ -335,7 +342,9 @@ public BaseResponseCapabilities getCapabilities(@javax.annotation.Nonnull Intege 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse getCapabilitiesWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { okhttp3.Call localVarCall = getCapabilitiesValidateBeforeCall(analysisId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -356,7 +365,9 @@ public ApiResponse getCapabilitiesWithHttpInfo(@javax. 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getCapabilitiesAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getCapabilitiesValidateBeforeCall(analysisId, _callback); @@ -683,6 +694,159 @@ public okhttp3.Call getTagsAsync(@javax.annotation.Nonnull Integer analysisId, f localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetAnalysisXref + * @param analysisId Analysis ID (required) + * @param vaddr Virtual address to match against xrefs (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetAnalysisXrefCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long vaddr, 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/analyses/{analysis_id}/xrefs/{vaddr}" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .replace("{" + "vaddr" + "}", localVarApiClient.escapeString(vaddr.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3GetAnalysisXrefValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long vaddr, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling v3GetAnalysisXref(Async)"); + } + + // verify the required parameter 'vaddr' is set + if (vaddr == null) { + throw new ApiException("Missing the required parameter 'vaddr' when calling v3GetAnalysisXref(Async)"); + } + + return v3GetAnalysisXrefCall(analysisId, vaddr, _callback); + + } + + /** + * Look up xrefs by virtual address. + * Returns every cross-reference into and out of a virtual address, read from the analysis' cache. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param vaddr Virtual address to match against xrefs (required) + * @return AnalysisXrefOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public AnalysisXrefOutputBody v3GetAnalysisXref(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long vaddr) throws ApiException { + ApiResponse localVarResp = v3GetAnalysisXrefWithHttpInfo(analysisId, vaddr); + return localVarResp.getData(); + } + + /** + * Look up xrefs by virtual address. + * Returns every cross-reference into and out of a virtual address, read from the analysis' cache. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param vaddr Virtual address to match against xrefs (required) + * @return ApiResponse<AnalysisXrefOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3GetAnalysisXrefWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long vaddr) throws ApiException { + okhttp3.Call localVarCall = v3GetAnalysisXrefValidateBeforeCall(analysisId, vaddr, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Look up xrefs by virtual address. (asynchronously) + * Returns every cross-reference into and out of a virtual address, read from the analysis' cache. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param vaddr Virtual address to match against xrefs (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetAnalysisXrefAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long vaddr, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAnalysisXrefValidateBeforeCall(analysisId, vaddr, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3ListAnalysisCapabilities * @param analysisId Analysis ID (required) @@ -826,4 +990,147 @@ public okhttp3.Call v3ListAnalysisCapabilitiesAsync(@javax.annotation.Nonnull Lo localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3ListAnalysisTags + * @param analysisId Analysis ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListAnalysisTagsCall(@javax.annotation.Nonnull Long analysisId, 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/analyses/{analysis_id}/tags" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3ListAnalysisTagsValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'analysisId' is set + if (analysisId == null) { + throw new ApiException("Missing the required parameter 'analysisId' when calling v3ListAnalysisTags(Async)"); + } + + return v3ListAnalysisTagsCall(analysisId, _callback); + + } + + /** + * List the tags on an analysis. + * Returns every tag on the analysis' binary, of any origin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return AnalysisTagsOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public AnalysisTagsOutputBody v3ListAnalysisTags(@javax.annotation.Nonnull Long analysisId) throws ApiException { + ApiResponse localVarResp = v3ListAnalysisTagsWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * List the tags on an analysis. + * Returns every tag on the analysis' binary, of any origin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return ApiResponse<AnalysisTagsOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3ListAnalysisTagsWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3ListAnalysisTagsValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List the tags on an analysis. (asynchronously) + * Returns every tag on the analysis' binary, of any origin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListAnalysisTagsAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3ListAnalysisTagsValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/api/BinariesApi.java b/src/main/java/ai/reveng/api/BinariesApi.java index ec3ad00..06b67a8 100644 --- a/src/main/java/ai/reveng/api/BinariesApi.java +++ b/src/main/java/ai/reveng/api/BinariesApi.java @@ -38,9 +38,11 @@ import java.io.File; import ai.reveng.model.GetAdditionalDetailsOutputBody; import ai.reveng.model.GetAdditionalDetailsStatusOutputBody; +import ai.reveng.model.GetBinaryExternalsOutputBody; import ai.reveng.model.GetDieInfoOutputBody; import ai.reveng.model.GetRelatedBinariesOutputBody; import ai.reveng.model.GetRelatedStatusOutputBody; +import ai.reveng.model.SearchBinariesOutputBody; import ai.reveng.model.UploadOutputBody; import java.lang.reflect.Type; @@ -928,7 +930,9 @@ public okhttp3.Call getBinaryDetailsAsync(@javax.annotation.Nonnull Integer bina 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getBinaryDieInfoCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -974,6 +978,7 @@ public okhttp3.Call getBinaryDieInfoCall(@javax.annotation.Nonnull Integer binar return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getBinaryDieInfoValidateBeforeCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'binaryId' is set @@ -998,7 +1003,9 @@ private okhttp3.Call getBinaryDieInfoValidateBeforeCall(@javax.annotation.Nonnul 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseListDieMatch getBinaryDieInfo(@javax.annotation.Nonnull Integer binaryId) throws ApiException { ApiResponse localVarResp = getBinaryDieInfoWithHttpInfo(binaryId); return localVarResp.getData(); @@ -1017,7 +1024,9 @@ public BaseResponseListDieMatch getBinaryDieInfo(@javax.annotation.Nonnull Integ 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse getBinaryDieInfoWithHttpInfo(@javax.annotation.Nonnull Integer binaryId) throws ApiException { okhttp3.Call localVarCall = getBinaryDieInfoValidateBeforeCall(binaryId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -1038,7 +1047,9 @@ public ApiResponse getBinaryDieInfoWithHttpInfo(@javax 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getBinaryDieInfoAsync(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getBinaryDieInfoValidateBeforeCall(binaryId, _callback); @@ -1190,7 +1201,9 @@ public okhttp3.Call getBinaryExternalsAsync(@javax.annotation.Nonnull Integer bi 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getBinaryRelatedStatusCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -1236,6 +1249,7 @@ public okhttp3.Call getBinaryRelatedStatusCall(@javax.annotation.Nonnull Integer return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getBinaryRelatedStatusValidateBeforeCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'binaryId' is set @@ -1260,7 +1274,9 @@ private okhttp3.Call getBinaryRelatedStatusValidateBeforeCall(@javax.annotation. 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseBinariesRelatedStatusResponse getBinaryRelatedStatus(@javax.annotation.Nonnull Integer binaryId) throws ApiException { ApiResponse localVarResp = getBinaryRelatedStatusWithHttpInfo(binaryId); return localVarResp.getData(); @@ -1279,7 +1295,9 @@ public BaseResponseBinariesRelatedStatusResponse getBinaryRelatedStatus(@javax.a 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse getBinaryRelatedStatusWithHttpInfo(@javax.annotation.Nonnull Integer binaryId) throws ApiException { okhttp3.Call localVarCall = getBinaryRelatedStatusValidateBeforeCall(binaryId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -1300,7 +1318,9 @@ public ApiResponse getBinaryRelatedSt 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getBinaryRelatedStatusAsync(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getBinaryRelatedStatusValidateBeforeCall(binaryId, _callback); @@ -1322,7 +1342,9 @@ public okhttp3.Call getBinaryRelatedStatusAsync(@javax.annotation.Nonnull Intege 422 Invalid request parameters - 403 Forbidden - + * @deprecated */ + @Deprecated public okhttp3.Call getRelatedBinariesCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -1368,6 +1390,7 @@ public okhttp3.Call getRelatedBinariesCall(@javax.annotation.Nonnull Integer bin return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getRelatedBinariesValidateBeforeCall(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'binaryId' is set @@ -1393,7 +1416,9 @@ private okhttp3.Call getRelatedBinariesValidateBeforeCall(@javax.annotation.Nonn 422 Invalid request parameters - 403 Forbidden - + * @deprecated */ + @Deprecated public BaseResponseChildBinariesResponse getRelatedBinaries(@javax.annotation.Nonnull Integer binaryId) throws ApiException { ApiResponse localVarResp = getRelatedBinariesWithHttpInfo(binaryId); return localVarResp.getData(); @@ -1413,7 +1438,9 @@ public BaseResponseChildBinariesResponse getRelatedBinaries(@javax.annotation.No 422 Invalid request parameters - 403 Forbidden - + * @deprecated */ + @Deprecated public ApiResponse getRelatedBinariesWithHttpInfo(@javax.annotation.Nonnull Integer binaryId) throws ApiException { okhttp3.Call localVarCall = getRelatedBinariesValidateBeforeCall(binaryId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -1435,7 +1462,9 @@ public ApiResponse getRelatedBinariesWithHttp 422 Invalid request parameters - 403 Forbidden - + * @deprecated */ + @Deprecated public okhttp3.Call getRelatedBinariesAsync(@javax.annotation.Nonnull Integer binaryId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getRelatedBinariesValidateBeforeCall(binaryId, _callback); @@ -1443,6 +1472,145 @@ public okhttp3.Call getRelatedBinariesAsync(@javax.annotation.Nonnull Integer bi localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3DownloadBinaryZipped + * @param binaryId Binary ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3DownloadBinaryZippedCall(@javax.annotation.Nonnull Long binaryId, 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/binaries/{binary_id}/download-zipped" + .replace("{" + "binary_id" + "}", localVarApiClient.escapeString(binaryId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3DownloadBinaryZippedValidateBeforeCall(@javax.annotation.Nonnull Long binaryId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'binaryId' is set + if (binaryId == null) { + throw new ApiException("Missing the required parameter 'binaryId' when calling v3DownloadBinaryZipped(Async)"); + } + + return v3DownloadBinaryZippedCall(binaryId, _callback); + + } + + /** + * Download a binary as a password-protected zip. + * Streams the binary's uploaded file back as a zip archive, encrypted with a fixed password (`infected`) that deters antivirus scanning in transit rather than protecting confidentiality. Only the binary's owner, or an admin/superadmin, may download it; an internally-managed account's binary can only be downloaded by a superadmin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param binaryId Binary ID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public void v3DownloadBinaryZipped(@javax.annotation.Nonnull Long binaryId) throws ApiException { + v3DownloadBinaryZippedWithHttpInfo(binaryId); + } + + /** + * Download a binary as a password-protected zip. + * Streams the binary's uploaded file back as a zip archive, encrypted with a fixed password (`infected`) that deters antivirus scanning in transit rather than protecting confidentiality. Only the binary's owner, or an admin/superadmin, may download it; an internally-managed account's binary can only be downloaded by a superadmin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param binaryId Binary ID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3DownloadBinaryZippedWithHttpInfo(@javax.annotation.Nonnull Long binaryId) throws ApiException { + okhttp3.Call localVarCall = v3DownloadBinaryZippedValidateBeforeCall(binaryId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Download a binary as a password-protected zip. (asynchronously) + * Streams the binary's uploaded file back as a zip archive, encrypted with a fixed password (`infected`) that deters antivirus scanning in transit rather than protecting confidentiality. Only the binary's owner, or an admin/superadmin, may download it; an internally-managed account's binary can only be downloaded by a superadmin. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param binaryId Binary ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3DownloadBinaryZippedAsync(@javax.annotation.Nonnull Long binaryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3DownloadBinaryZippedValidateBeforeCall(binaryId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for v3GetBinaryDieInfo * @param binaryId Binary ID (required) @@ -1586,6 +1754,149 @@ public okhttp3.Call v3GetBinaryDieInfoAsync(@javax.annotation.Nonnull Long binar localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetBinaryExternals + * @param binaryId Binary ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetBinaryExternalsCall(@javax.annotation.Nonnull Long binaryId, 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/binaries/{binary_id}/externals" + .replace("{" + "binary_id" + "}", localVarApiClient.escapeString(binaryId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3GetBinaryExternalsValidateBeforeCall(@javax.annotation.Nonnull Long binaryId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'binaryId' is set + if (binaryId == null) { + throw new ApiException("Missing the required parameter 'binaryId' when calling v3GetBinaryExternals(Async)"); + } + + return v3GetBinaryExternalsCall(binaryId, _callback); + + } + + /** + * Get third-party threat-intel lookups for a binary. + * Returns VirusTotal and MalwareBazaar lookup results for the binary's content hash. `externals` is null until at least one lookup has run. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param binaryId Binary ID (required) + * @return GetBinaryExternalsOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public GetBinaryExternalsOutputBody v3GetBinaryExternals(@javax.annotation.Nonnull Long binaryId) throws ApiException { + ApiResponse localVarResp = v3GetBinaryExternalsWithHttpInfo(binaryId); + return localVarResp.getData(); + } + + /** + * Get third-party threat-intel lookups for a binary. + * Returns VirusTotal and MalwareBazaar lookup results for the binary's content hash. `externals` is null until at least one lookup has run. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param binaryId Binary ID (required) + * @return ApiResponse<GetBinaryExternalsOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3GetBinaryExternalsWithHttpInfo(@javax.annotation.Nonnull Long binaryId) throws ApiException { + okhttp3.Call localVarCall = v3GetBinaryExternalsValidateBeforeCall(binaryId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get third-party threat-intel lookups for a binary. (asynchronously) + * Returns VirusTotal and MalwareBazaar lookup results for the binary's content hash. `externals` is null until at least one lookup has run. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param binaryId Binary ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetBinaryExternalsAsync(@javax.annotation.Nonnull Long binaryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetBinaryExternalsValidateBeforeCall(binaryId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3GetBinaryRelated * @param binaryId Binary ID (required) @@ -1872,6 +2183,203 @@ public okhttp3.Call v3GetBinaryRelatedStatusAsync(@javax.annotation.Nonnull Long localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3SearchBinaries + * @param partialName Partial or full binary name to search for (optional) + * @param partialSha256 Partial or full SHA-256 hash to search for (optional) + * @param tags Restrict results to binaries carrying at least one of these tags (optional) + * @param modelName Restrict results to binaries analysed with this model (optional) + * @param userFilesOnly Restrict results to files the caller uploaded themself (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) + * @param userIds Restrict results to binaries owned by one of these user IDs (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SearchBinariesCall(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Long excludeBinaryId, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, 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/binaries"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (partialName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("partial_name", partialName)); + } + + if (partialSha256 != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("partial_sha256", partialSha256)); + } + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + if (modelName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("model_name", modelName)); + } + + if (userFilesOnly != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("user_files_only", userFilesOnly)); + } + + if (excludeBinaryId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("exclude_binary_id", excludeBinaryId)); + } + + if (userIds != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user_ids", userIds)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3SearchBinariesValidateBeforeCall(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Long excludeBinaryId, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + return v3SearchBinariesCall(partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, userIds, limit, offset, _callback); + + } + + /** + * Search binaries + * Searches for binaries visible to the caller. At least one of partial_name, partial_sha256, tags, or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full binary name to search for (optional) + * @param partialSha256 Partial or full SHA-256 hash to search for (optional) + * @param tags Restrict results to binaries carrying at least one of these tags (optional) + * @param modelName Restrict results to binaries analysed with this model (optional) + * @param userFilesOnly Restrict results to files the caller uploaded themself (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) + * @param userIds Restrict results to binaries owned by one of these user IDs (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @return SearchBinariesOutputBody + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public SearchBinariesOutputBody v3SearchBinaries(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Long excludeBinaryId, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset) throws ApiException { + ApiResponse localVarResp = v3SearchBinariesWithHttpInfo(partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, userIds, limit, offset); + return localVarResp.getData(); + } + + /** + * Search binaries + * Searches for binaries visible to the caller. At least one of partial_name, partial_sha256, tags, or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full binary name to search for (optional) + * @param partialSha256 Partial or full SHA-256 hash to search for (optional) + * @param tags Restrict results to binaries carrying at least one of these tags (optional) + * @param modelName Restrict results to binaries analysed with this model (optional) + * @param userFilesOnly Restrict results to files the caller uploaded themself (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) + * @param userIds Restrict results to binaries owned by one of these user IDs (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @return ApiResponse<SearchBinariesOutputBody> + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3SearchBinariesWithHttpInfo(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Long excludeBinaryId, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset) throws ApiException { + okhttp3.Call localVarCall = v3SearchBinariesValidateBeforeCall(partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, userIds, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Search binaries (asynchronously) + * Searches for binaries visible to the caller. At least one of partial_name, partial_sha256, tags, or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full binary name to search for (optional) + * @param partialSha256 Partial or full SHA-256 hash to search for (optional) + * @param tags Restrict results to binaries carrying at least one of these tags (optional) + * @param modelName Restrict results to binaries analysed with this model (optional) + * @param userFilesOnly Restrict results to files the caller uploaded themself (optional, default to false) + * @param excludeBinaryId A binary ID to exclude from the results (optional) + * @param userIds Restrict results to binaries owned by one of these user IDs (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SearchBinariesAsync(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String partialSha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Boolean userFilesOnly, @javax.annotation.Nullable Long excludeBinaryId, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3SearchBinariesValidateBeforeCall(partialName, partialSha256, tags, modelName, userFilesOnly, excludeBinaryId, userIds, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3UploadFile * @param _file The file's raw bytes. (required) diff --git a/src/main/java/ai/reveng/api/CollectionsApi.java b/src/main/java/ai/reveng/api/CollectionsApi.java index dcf8006..3dbdf53 100644 --- a/src/main/java/ai/reveng/api/CollectionsApi.java +++ b/src/main/java/ai/reveng/api/CollectionsApi.java @@ -1792,7 +1792,11 @@ public okhttp3.Call v3GetCollectionAsync(@javax.annotation.Nonnull Long collecti } /** * Build call for v3ListCollections - * @param searchTerm (optional) + * @param searchTerm Partial or full collection name to search for (optional) + * @param binaryName Only return Collections containing a Binary whose name contains this (optional) + * @param binarySha256 Only return Collections containing a Binary whose SHA-256 hash contains this (optional) + * @param tags Only return Collections carrying at least one of these Tags (optional) + * @param userIds Restrict results to Collections owned by one of these user IDs (optional) * @param filters (optional) * @param limit (optional, default to 20) * @param offset (optional, default to 0) @@ -1810,7 +1814,7 @@ public okhttp3.Call v3GetCollectionAsync(@javax.annotation.Nonnull Long collecti 500 Internal Server Error - */ - public okhttp3.Call v3ListCollectionsCall(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v3ListCollectionsCall(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable String binaryName, @javax.annotation.Nullable String binarySha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -1839,6 +1843,22 @@ public okhttp3.Call v3ListCollectionsCall(@javax.annotation.Nullable String sear localVarQueryParams.addAll(localVarApiClient.parameterToPair("search_term", searchTerm)); } + if (binaryName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("binary_name", binaryName)); + } + + if (binarySha256 != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("binary_sha256", binarySha256)); + } + + if (tags != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "tags", tags)); + } + + if (userIds != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "user_ids", userIds)); + } + if (filters != null) { localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "filters", filters)); } @@ -1879,15 +1899,19 @@ public okhttp3.Call v3ListCollectionsCall(@javax.annotation.Nullable String sear } @SuppressWarnings("rawtypes") - private okhttp3.Call v3ListCollectionsValidateBeforeCall(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { - return v3ListCollectionsCall(searchTerm, filters, limit, offset, orderBy, order, _callback); + private okhttp3.Call v3ListCollectionsValidateBeforeCall(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable String binaryName, @javax.annotation.Nullable String binarySha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { + return v3ListCollectionsCall(searchTerm, binaryName, binarySha256, tags, userIds, filters, limit, offset, orderBy, order, _callback); } /** * List collections. - * Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - * @param searchTerm (optional) + * Lists collections accessible to the authenticated user. Supports search by collection name, contained binary name/SHA-256, tags, owner, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param searchTerm Partial or full collection name to search for (optional) + * @param binaryName Only return Collections containing a Binary whose name contains this (optional) + * @param binarySha256 Only return Collections containing a Binary whose SHA-256 hash contains this (optional) + * @param tags Only return Collections carrying at least one of these Tags (optional) + * @param userIds Restrict results to Collections owned by one of these user IDs (optional) * @param filters (optional) * @param limit (optional, default to 20) * @param offset (optional, default to 0) @@ -1904,15 +1928,19 @@ private okhttp3.Call v3ListCollectionsValidateBeforeCall(@javax.annotation.Nulla 500 Internal Server Error - */ - public ListCollectionsOutputBody v3ListCollections(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { - ApiResponse localVarResp = v3ListCollectionsWithHttpInfo(searchTerm, filters, limit, offset, orderBy, order); + public ListCollectionsOutputBody v3ListCollections(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable String binaryName, @javax.annotation.Nullable String binarySha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { + ApiResponse localVarResp = v3ListCollectionsWithHttpInfo(searchTerm, binaryName, binarySha256, tags, userIds, filters, limit, offset, orderBy, order); return localVarResp.getData(); } /** * List collections. - * Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - * @param searchTerm (optional) + * Lists collections accessible to the authenticated user. Supports search by collection name, contained binary name/SHA-256, tags, owner, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param searchTerm Partial or full collection name to search for (optional) + * @param binaryName Only return Collections containing a Binary whose name contains this (optional) + * @param binarySha256 Only return Collections containing a Binary whose SHA-256 hash contains this (optional) + * @param tags Only return Collections carrying at least one of these Tags (optional) + * @param userIds Restrict results to Collections owned by one of these user IDs (optional) * @param filters (optional) * @param limit (optional, default to 20) * @param offset (optional, default to 0) @@ -1929,16 +1957,20 @@ public ListCollectionsOutputBody v3ListCollections(@javax.annotation.Nullable St 500 Internal Server Error - */ - public ApiResponse v3ListCollectionsWithHttpInfo(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { - okhttp3.Call localVarCall = v3ListCollectionsValidateBeforeCall(searchTerm, filters, limit, offset, orderBy, order, null); + public ApiResponse v3ListCollectionsWithHttpInfo(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable String binaryName, @javax.annotation.Nullable String binarySha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { + okhttp3.Call localVarCall = v3ListCollectionsValidateBeforeCall(searchTerm, binaryName, binarySha256, tags, userIds, filters, limit, offset, orderBy, order, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * List collections. (asynchronously) - * Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - * @param searchTerm (optional) + * Lists collections accessible to the authenticated user. Supports search by collection name, contained binary name/SHA-256, tags, owner, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param searchTerm Partial or full collection name to search for (optional) + * @param binaryName Only return Collections containing a Binary whose name contains this (optional) + * @param binarySha256 Only return Collections containing a Binary whose SHA-256 hash contains this (optional) + * @param tags Only return Collections carrying at least one of these Tags (optional) + * @param userIds Restrict results to Collections owned by one of these user IDs (optional) * @param filters (optional) * @param limit (optional, default to 20) * @param offset (optional, default to 0) @@ -1956,9 +1988,9 @@ public ApiResponse v3ListCollectionsWithHttpInfo(@jav 500 Internal Server Error - */ - public okhttp3.Call v3ListCollectionsAsync(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v3ListCollectionsAsync(@javax.annotation.Nullable String searchTerm, @javax.annotation.Nullable String binaryName, @javax.annotation.Nullable String binarySha256, @javax.annotation.Nullable List tags, @javax.annotation.Nullable List userIds, @javax.annotation.Nullable List filters, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = v3ListCollectionsValidateBeforeCall(searchTerm, filters, limit, offset, orderBy, order, _callback); + okhttp3.Call localVarCall = v3ListCollectionsValidateBeforeCall(searchTerm, binaryName, binarySha256, tags, userIds, filters, limit, offset, orderBy, order, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; diff --git a/src/main/java/ai/reveng/api/ConfigApi.java b/src/main/java/ai/reveng/api/ConfigApi.java index 861766e..b956712 100644 --- a/src/main/java/ai/reveng/api/ConfigApi.java +++ b/src/main/java/ai/reveng/api/ConfigApi.java @@ -87,7 +87,9 @@ public void setCustomBaseUrl(String customBaseUrl) { 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getConfigCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -132,6 +134,7 @@ public okhttp3.Call getConfigCall(final ApiCallback _callback) throws ApiExcepti return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getConfigValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getConfigCall(_callback); @@ -150,7 +153,9 @@ private okhttp3.Call getConfigValidateBeforeCall(final ApiCallback _callback) th 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseConfigResponse getConfig() throws ApiException { ApiResponse localVarResp = getConfigWithHttpInfo(); return localVarResp.getData(); @@ -168,7 +173,9 @@ public BaseResponseConfigResponse getConfig() throws ApiException { 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse getConfigWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getConfigValidateBeforeCall(null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -188,7 +195,9 @@ public ApiResponse getConfigWithHttpInfo() throws Ap 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getConfigAsync(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getConfigValidateBeforeCall(_callback); diff --git a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java index 064f45c..c5f492b 100644 --- a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java +++ b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java @@ -27,6 +27,8 @@ import ai.reveng.model.APIError; +import ai.reveng.model.AcceptTypeSuggestionsInputBody; +import ai.reveng.model.AcceptTypeSuggestionsOutputBody; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseUnionGetAiDecompilationRatingResponseNoneType; import ai.reveng.model.CommentsData; @@ -2120,6 +2122,167 @@ public okhttp3.Call upsertAiDecompilationRatingAsync(@javax.annotation.Nonnull L localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3AcceptAiDecompilationTypeSuggestions + * @param functionId Function ID (required) + * @param acceptTypeSuggestionsInputBody (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 -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3AcceptAiDecompilationTypeSuggestionsCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull AcceptTypeSuggestionsInputBody acceptTypeSuggestionsInputBody, 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 = acceptTypeSuggestionsInputBody; + + // create path and map variables + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/type-suggestions/accept" + .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3AcceptAiDecompilationTypeSuggestionsValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull AcceptTypeSuggestionsInputBody acceptTypeSuggestionsInputBody, 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 v3AcceptAiDecompilationTypeSuggestions(Async)"); + } + + // verify the required parameter 'acceptTypeSuggestionsInputBody' is set + if (acceptTypeSuggestionsInputBody == null) { + throw new ApiException("Missing the required parameter 'acceptTypeSuggestionsInputBody' when calling v3AcceptAiDecompilationTypeSuggestions(Async)"); + } + + return v3AcceptAiDecompilationTypeSuggestionsCall(functionId, acceptTypeSuggestionsInputBody, _callback); + + } + + /** + * Accept AI decompilation type suggestions + * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param acceptTypeSuggestionsInputBody (required) + * @return AcceptTypeSuggestionsOutputBody + * @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 -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public AcceptTypeSuggestionsOutputBody v3AcceptAiDecompilationTypeSuggestions(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull AcceptTypeSuggestionsInputBody acceptTypeSuggestionsInputBody) throws ApiException { + ApiResponse localVarResp = v3AcceptAiDecompilationTypeSuggestionsWithHttpInfo(functionId, acceptTypeSuggestionsInputBody); + return localVarResp.getData(); + } + + /** + * Accept AI decompilation type suggestions + * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param acceptTypeSuggestionsInputBody (required) + * @return ApiResponse<AcceptTypeSuggestionsOutputBody> + * @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 -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3AcceptAiDecompilationTypeSuggestionsWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull AcceptTypeSuggestionsInputBody acceptTypeSuggestionsInputBody) throws ApiException { + okhttp3.Call localVarCall = v3AcceptAiDecompilationTypeSuggestionsValidateBeforeCall(functionId, acceptTypeSuggestionsInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Accept AI decompilation type suggestions (asynchronously) + * Stores the named type suggestions as data types of this function's analysis, with a `source_type` of `AI_DECOMP` and this function as their `source_function_id`. Each suggestion is stored as the type suggestions endpoint renders it: a `STRUCT` where members were placed, a `TYPEDEF` where the suggestion is a name for a scalar, and an `UNKNOWN` type where nothing gave it a shape. A member with no offset or width is left out and counted in `skipped_members`. A type expression a member names is matched against the analysis by name alone and created where nothing matches: `char *` creates a `char` `BASE` type and a `POINTER` type pointing at it, reusing either where the analysis already holds it. A member naming another suggestion accepted by the same request resolves to it. Only a trailing `*` is taken apart, so a name like `int &` stands for one type. No size is stored: the widths a suggestion carries are lower bounds rather than the type's own. A suggestion the analysis already holds a type of that name and kind for resolves to it, so repeating a request stores nothing further. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param acceptTypeSuggestionsInputBody (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 -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3AcceptAiDecompilationTypeSuggestionsAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull AcceptTypeSuggestionsInputBody acceptTypeSuggestionsInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3AcceptAiDecompilationTypeSuggestionsValidateBeforeCall(functionId, acceptTypeSuggestionsInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3GetAiDecompilationLineAttributions * @param functionId Function ID (required) diff --git a/src/main/java/ai/reveng/api/FunctionsCoreApi.java b/src/main/java/ai/reveng/api/FunctionsCoreApi.java index 99a7974..0b6117c 100644 --- a/src/main/java/ai/reveng/api/FunctionsCoreApi.java +++ b/src/main/java/ai/reveng/api/FunctionsCoreApi.java @@ -51,6 +51,7 @@ import ai.reveng.model.ListAnalysisFunctionsOutputBody; import ai.reveng.model.ListFunctionStringsOutputBody; import ai.reveng.model.ListImportedFunctionsOutputBody; +import ai.reveng.model.SearchFunctionsOutputBody; import ai.reveng.model.StartMatchingForFunctionsInputBody; import ai.reveng.model.StartMatchingOutputBody; @@ -3713,4 +3714,161 @@ public okhttp3.Call v3CanonicalizeFunctionNamesAsync(@javax.annotation.Nonnull C localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3SearchFunctions + * @param partialName Partial or full function name to search for (optional) + * @param modelName Restrict results to functions analysed with this model (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SearchFunctionsCall(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, 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"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (partialName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("partial_name", partialName)); + } + + if (modelName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("model_name", modelName)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3SearchFunctionsValidateBeforeCall(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + return v3SearchFunctionsCall(partialName, modelName, limit, offset, _callback); + + } + + /** + * Search functions + * Searches for functions visible to the caller. At least one of partial_name or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full function name to search for (optional) + * @param modelName Restrict results to functions analysed with this model (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @return SearchFunctionsOutputBody + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public SearchFunctionsOutputBody v3SearchFunctions(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset) throws ApiException { + ApiResponse localVarResp = v3SearchFunctionsWithHttpInfo(partialName, modelName, limit, offset); + return localVarResp.getData(); + } + + /** + * Search functions + * Searches for functions visible to the caller. At least one of partial_name or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full function name to search for (optional) + * @param modelName Restrict results to functions analysed with this model (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @return ApiResponse<SearchFunctionsOutputBody> + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3SearchFunctionsWithHttpInfo(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset) throws ApiException { + okhttp3.Call localVarCall = v3SearchFunctionsValidateBeforeCall(partialName, modelName, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Search functions (asynchronously) + * Searches for functions visible to the caller. At least one of partial_name or model_name must be provided. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param partialName Partial or full function name to search for (optional) + * @param modelName Restrict results to functions analysed with this model (optional) + * @param limit Maximum results to return (optional, default to 10) + * @param offset Number of results to skip (optional, default to 0) + * @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 -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SearchFunctionsAsync(@javax.annotation.Nullable String partialName, @javax.annotation.Nullable String modelName, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable Long offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3SearchFunctionsValidateBeforeCall(partialName, modelName, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/api/ModelsApi.java b/src/main/java/ai/reveng/api/ModelsApi.java index c5af367..9e3430d 100644 --- a/src/main/java/ai/reveng/api/ModelsApi.java +++ b/src/main/java/ai/reveng/api/ModelsApi.java @@ -84,7 +84,9 @@ public void setCustomBaseUrl(String customBaseUrl) { 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getModelsCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -129,6 +131,7 @@ public okhttp3.Call getModelsCall(final ApiCallback _callback) throws ApiExcepti return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getModelsValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getModelsCall(_callback); @@ -147,7 +150,9 @@ private okhttp3.Call getModelsValidateBeforeCall(final ApiCallback _callback) th 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseModelsResponse getModels() throws ApiException { ApiResponse localVarResp = getModelsWithHttpInfo(); return localVarResp.getData(); @@ -165,7 +170,9 @@ public BaseResponseModelsResponse getModels() throws ApiException { 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse getModelsWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getModelsValidateBeforeCall(null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -185,7 +192,9 @@ public ApiResponse getModelsWithHttpInfo() throws Ap 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getModelsAsync(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getModelsValidateBeforeCall(_callback); diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index ad1cdbe..383cb5e 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -148,7 +148,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/4.54.0/java"); + setUserAgent("OpenAPI-Generator/4.60.1/java"); authentications = new HashMap(); } diff --git a/src/main/java/ai/reveng/invoker/Configuration.java b/src/main/java/ai/reveng/invoker/Configuration.java index 61a190d..c12aa5b 100644 --- a/src/main/java/ai/reveng/invoker/Configuration.java +++ b/src/main/java/ai/reveng/invoker/Configuration.java @@ -18,7 +18,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "4.54.0"; + public static final String VERSION = "4.60.1"; private static final AtomicReference defaultApiClient = new AtomicReference<>(); private static volatile Supplier apiClientFactory = ApiClient::new; diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index e052aa7..34745bc 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -175,6 +175,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.APIError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AcceptTypeSuggestionsInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AcceptTypeSuggestionsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AcceptedType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddCalleeInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddCollectionBinariesInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddIssuerDomainInputBody.CustomTypeAdapterFactory()); @@ -183,6 +186,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddUserStringInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddUserStringToFunctionInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AdditionalDetailsStatusResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AgentWorkflowUsageOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalyseCapabilitiesBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisAccessBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisAccessInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisBasicInfoOutputBody.CustomTypeAdapterFactory()); @@ -217,9 +222,11 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisStringsStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTagBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTags.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisTagsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateTagsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisUpdateTagsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisXrefOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ApiCall.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ApiCombinationEvidence.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2AgentSchemaCapability.CustomTypeAdapterFactory()); @@ -313,10 +320,15 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryDetailsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryExportMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryExportResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryExternalsBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryExternalsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinarySearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinarySearchResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinarySearchResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BitfieldDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkAddTagsInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkAddTagsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkAddTagsResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkCreateUserResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkCreateUsersOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkDeleteAnalysesInputBody.CustomTypeAdapterFactory()); @@ -393,6 +405,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateStructDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateTeamInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateTypedefDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateURLRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateURLResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateUnionDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateUnknownDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateUserInputBody.CustomTypeAdapterFactory()); @@ -405,6 +419,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CryptoFinding.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CryptoScanMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CryptoScanResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CryptoVerification.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DailyAnalysesCountOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DailyCountBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeEnumValueEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeFunctionEntry.CustomTypeAdapterFactory()); @@ -474,6 +491,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExecutionFinding.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExecutionScanMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExecutionScanResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExecutionVerification.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExternalResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ExtractedBinary.CustomTypeAdapterFactory()); @@ -491,6 +509,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FilesystemFinding.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FilesystemScanMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FilesystemScanResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FilesystemVerification.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Finding.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FormFile.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionBlockDestinationResponse.CustomTypeAdapterFactory()); @@ -511,6 +530,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionRenameMap.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSearchResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSearchResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSignatureBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSignatureEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSignatureVersion.CustomTypeAdapterFactory()); @@ -529,6 +549,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAiDecompilationRatingResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAnalysisLogsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAnalysisStringsStatusOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetBinaryExternalsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetCollectionOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetConfigOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetDataTypeHistoryBody.CustomTypeAdapterFactory()); @@ -608,6 +629,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NetworkingFinding.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NetworkingScanMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NetworkingScanResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.NetworkingVerification.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OIDCCallbackInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationBinaryExportMetadataBinaryExportResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationCreateMetadataCreateResult.CustomTypeAdapterFactory()); @@ -677,6 +699,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameUnnamedFunctionsResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenderedToken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportAnalysisBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportAnalysisResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportInfo.CustomTypeAdapterFactory()); @@ -694,6 +717,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ScrapeThirdPartyConfig.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ScreenshotEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ScreenshotsIndex.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SearchBinariesOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SearchFunctionsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SearchTagsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SecretsAgentResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SectionModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SecurityFinding.CustomTypeAdapterFactory()); @@ -714,6 +740,7 @@ 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.SoftwareTypeCountsBody.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()); @@ -764,6 +791,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagSearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagSearchResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TagSearchResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TaskResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TaskStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TcpCarvedFile.CustomTypeAdapterFactory()); @@ -813,6 +841,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdatePointerDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateProfileInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateStructDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateTagsInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateTeamInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateTypedefDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateUnionDataType.CustomTypeAdapterFactory()); @@ -832,9 +861,13 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserIdentity.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserProfile.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WarningEvent.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WorkflowDayBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WorkflowProgress.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefFromBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefFromResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefIntoBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefSegmentBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefToResponse.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/src/main/java/ai/reveng/model/AcceptTypeSuggestionsInputBody.java b/src/main/java/ai/reveng/model/AcceptTypeSuggestionsInputBody.java new file mode 100644 index 0000000..c4810bf --- /dev/null +++ b/src/main/java/ai/reveng/model/AcceptTypeSuggestionsInputBody.java @@ -0,0 +1,302 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AcceptTypeSuggestionsInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AcceptTypeSuggestionsInputBody { + public static final String SERIALIZED_NAME_KEYS = "keys"; + @SerializedName(SERIALIZED_NAME_KEYS) + @javax.annotation.Nullable + private List keys; + + public AcceptTypeSuggestionsInputBody() { + } + + public AcceptTypeSuggestionsInputBody keys(@javax.annotation.Nullable List keys) { + this.keys = keys; + return this; + } + + public AcceptTypeSuggestionsInputBody addKeysItem(String keysItem) { + if (this.keys == null) { + this.keys = new ArrayList<>(); + } + this.keys.add(keysItem); + return this; + } + + /** + * Keys of the suggestions to store, as the type suggestions endpoint returns them. A key repeated in one request is stored once. + * @return keys + */ + @javax.annotation.Nullable + public List getKeys() { + return keys; + } + + public void setKeys(@javax.annotation.Nullable List keys) { + this.keys = keys; + } + + /** + * 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 AcceptTypeSuggestionsInputBody instance itself + */ + public AcceptTypeSuggestionsInputBody 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; + } + AcceptTypeSuggestionsInputBody acceptTypeSuggestionsInputBody = (AcceptTypeSuggestionsInputBody) o; + return Objects.equals(this.keys, acceptTypeSuggestionsInputBody.keys)&& + Objects.equals(this.additionalProperties, acceptTypeSuggestionsInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(keys, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AcceptTypeSuggestionsInputBody {\n"); + sb.append(" keys: ").append(toIndentedString(keys)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("keys")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("keys")); + } + + /** + * 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 AcceptTypeSuggestionsInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AcceptTypeSuggestionsInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AcceptTypeSuggestionsInputBody is not found in the empty JSON string", AcceptTypeSuggestionsInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AcceptTypeSuggestionsInputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("keys") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("keys").isJsonArray() && !jsonObj.get("keys").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `keys` to be an array in the JSON string but got `%s`", jsonObj.get("keys").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AcceptTypeSuggestionsInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AcceptTypeSuggestionsInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AcceptTypeSuggestionsInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AcceptTypeSuggestionsInputBody 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 AcceptTypeSuggestionsInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AcceptTypeSuggestionsInputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AcceptTypeSuggestionsInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AcceptTypeSuggestionsInputBody + * @throws IOException if the JSON string is invalid with respect to AcceptTypeSuggestionsInputBody + */ + public static AcceptTypeSuggestionsInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AcceptTypeSuggestionsInputBody.class); + } + + /** + * Convert an instance of AcceptTypeSuggestionsInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AcceptTypeSuggestionsOutputBody.java b/src/main/java/ai/reveng/model/AcceptTypeSuggestionsOutputBody.java new file mode 100644 index 0000000..3e72a8c --- /dev/null +++ b/src/main/java/ai/reveng/model/AcceptTypeSuggestionsOutputBody.java @@ -0,0 +1,348 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.AcceptedType; +import ai.reveng.model.DataTypeEntry; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AcceptTypeSuggestionsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AcceptTypeSuggestionsOutputBody { + public static final String SERIALIZED_NAME_ACCEPTED = "accepted"; + @SerializedName(SERIALIZED_NAME_ACCEPTED) + @javax.annotation.Nullable + private List accepted; + + public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; + @SerializedName(SERIALIZED_NAME_DATA_TYPES) + @javax.annotation.Nullable + private List dataTypes; + + public AcceptTypeSuggestionsOutputBody() { + } + + public AcceptTypeSuggestionsOutputBody accepted(@javax.annotation.Nullable List accepted) { + this.accepted = accepted; + return this; + } + + public AcceptTypeSuggestionsOutputBody addAcceptedItem(AcceptedType acceptedItem) { + if (this.accepted == null) { + this.accepted = new ArrayList<>(); + } + this.accepted.add(acceptedItem); + return this; + } + + /** + * One entry per requested suggestion, in request order. + * @return accepted + */ + @javax.annotation.Nullable + public List getAccepted() { + return accepted; + } + + public void setAccepted(@javax.annotation.Nullable List accepted) { + this.accepted = accepted; + } + + + public AcceptTypeSuggestionsOutputBody dataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + public AcceptTypeSuggestionsOutputBody addDataTypesItem(DataTypeEntry dataTypesItem) { + if (this.dataTypes == null) { + this.dataTypes = new ArrayList<>(); + } + this.dataTypes.add(dataTypesItem); + return this; + } + + /** + * The type each requested suggestion resolved to, plus every type minted to satisfy one, ordered by data_type_id. + * @return dataTypes + */ + @javax.annotation.Nullable + public List getDataTypes() { + return dataTypes; + } + + public void setDataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + } + + /** + * 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 AcceptTypeSuggestionsOutputBody instance itself + */ + public AcceptTypeSuggestionsOutputBody 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; + } + AcceptTypeSuggestionsOutputBody acceptTypeSuggestionsOutputBody = (AcceptTypeSuggestionsOutputBody) o; + return Objects.equals(this.accepted, acceptTypeSuggestionsOutputBody.accepted) && + Objects.equals(this.dataTypes, acceptTypeSuggestionsOutputBody.dataTypes)&& + Objects.equals(this.additionalProperties, acceptTypeSuggestionsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(accepted, dataTypes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AcceptTypeSuggestionsOutputBody {\n"); + sb.append(" accepted: ").append(toIndentedString(accepted)).append("\n"); + sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("accepted", "data_types")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("accepted", "data_types")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AcceptTypeSuggestionsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AcceptTypeSuggestionsOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AcceptTypeSuggestionsOutputBody is not found in the empty JSON string", AcceptTypeSuggestionsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AcceptTypeSuggestionsOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("accepted") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("accepted").isJsonArray() && !jsonObj.get("accepted").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `accepted` to be an array in the JSON string but got `%s`", jsonObj.get("accepted").toString())); + } + if (jsonObj.get("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { + if (!jsonObj.get("data_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data_types` to be an array in the JSON string but got `%s`", jsonObj.get("data_types").toString())); + } + JsonArray jsonArraydataTypes = jsonObj.getAsJsonArray("data_types"); + // validate the required field `data_types` (array) + for (int i = 0; i < jsonArraydataTypes.size(); i++) { + DataTypeEntry.validateJsonElement(jsonArraydataTypes.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AcceptTypeSuggestionsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AcceptTypeSuggestionsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AcceptTypeSuggestionsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AcceptTypeSuggestionsOutputBody 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 AcceptTypeSuggestionsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AcceptTypeSuggestionsOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AcceptTypeSuggestionsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AcceptTypeSuggestionsOutputBody + * @throws IOException if the JSON string is invalid with respect to AcceptTypeSuggestionsOutputBody + */ + public static AcceptTypeSuggestionsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AcceptTypeSuggestionsOutputBody.class); + } + + /** + * Convert an instance of AcceptTypeSuggestionsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AcceptedType.java b/src/main/java/ai/reveng/model/AcceptedType.java new file mode 100644 index 0000000..5be156a --- /dev/null +++ b/src/main/java/ai/reveng/model/AcceptedType.java @@ -0,0 +1,367 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AcceptedType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AcceptedType { + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + @javax.annotation.Nonnull + private Boolean created; + + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nonnull + private String key; + + public static final String SERIALIZED_NAME_SKIPPED_MEMBERS = "skipped_members"; + @SerializedName(SERIALIZED_NAME_SKIPPED_MEMBERS) + @javax.annotation.Nonnull + private Long skippedMembers; + + public AcceptedType() { + } + + public AcceptedType created(@javax.annotation.Nonnull Boolean created) { + this.created = created; + return this; + } + + /** + * False when the analysis already held a type under this name and kind, which this request resolved to rather than replaced. + * @return created + */ + @javax.annotation.Nonnull + public Boolean getCreated() { + return created; + } + + public void setCreated(@javax.annotation.Nonnull Boolean created) { + this.created = created; + } + + + public AcceptedType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The data type the suggestion is now stored as. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public AcceptedType key(@javax.annotation.Nonnull String key) { + this.key = key; + return this; + } + + /** + * The suggestion this entry answers. + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(@javax.annotation.Nonnull String key) { + this.key = key; + } + + + public AcceptedType skippedMembers(@javax.annotation.Nonnull Long skippedMembers) { + this.skippedMembers = skippedMembers; + return this; + } + + /** + * Members left out of the stored type because no offset or width was established for them. + * @return skippedMembers + */ + @javax.annotation.Nonnull + public Long getSkippedMembers() { + return skippedMembers; + } + + public void setSkippedMembers(@javax.annotation.Nonnull Long skippedMembers) { + this.skippedMembers = skippedMembers; + } + + /** + * 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 AcceptedType instance itself + */ + public AcceptedType 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; + } + AcceptedType acceptedType = (AcceptedType) o; + return Objects.equals(this.created, acceptedType.created) && + Objects.equals(this.dataTypeId, acceptedType.dataTypeId) && + Objects.equals(this.key, acceptedType.key) && + Objects.equals(this.skippedMembers, acceptedType.skippedMembers)&& + Objects.equals(this.additionalProperties, acceptedType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(created, dataTypeId, key, skippedMembers, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AcceptedType {\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" skippedMembers: ").append(toIndentedString(skippedMembers)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created", "data_type_id", "key", "skipped_members")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created", "data_type_id", "key", "skipped_members")); + } + + /** + * 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 AcceptedType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AcceptedType.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AcceptedType is not found in the empty JSON string", AcceptedType.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AcceptedType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AcceptedType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AcceptedType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AcceptedType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AcceptedType 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 AcceptedType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AcceptedType instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AcceptedType given an JSON string + * + * @param jsonString JSON string + * @return An instance of AcceptedType + * @throws IOException if the JSON string is invalid with respect to AcceptedType + */ + public static AcceptedType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AcceptedType.class); + } + + /** + * Convert an instance of AcceptedType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AgentWorkflowUsageOutputBody.java b/src/main/java/ai/reveng/model/AgentWorkflowUsageOutputBody.java new file mode 100644 index 0000000..b563ab4 --- /dev/null +++ b/src/main/java/ai/reveng/model/AgentWorkflowUsageOutputBody.java @@ -0,0 +1,303 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.WorkflowDayBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AgentWorkflowUsageOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AgentWorkflowUsageOutputBody { + public static final String SERIALIZED_NAME_REPORT = "report"; + @SerializedName(SERIALIZED_NAME_REPORT) + @javax.annotation.Nullable + private List report; + + public AgentWorkflowUsageOutputBody() { + } + + public AgentWorkflowUsageOutputBody report(@javax.annotation.Nullable List report) { + this.report = report; + return this; + } + + public AgentWorkflowUsageOutputBody addReportItem(WorkflowDayBody reportItem) { + if (this.report == null) { + this.report = new ArrayList<>(); + } + this.report.add(reportItem); + return this; + } + + /** + * One entry per day in the requested window, oldest first + * @return report + */ + @javax.annotation.Nullable + public List getReport() { + return report; + } + + public void setReport(@javax.annotation.Nullable List report) { + this.report = report; + } + + /** + * 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 AgentWorkflowUsageOutputBody instance itself + */ + public AgentWorkflowUsageOutputBody 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; + } + AgentWorkflowUsageOutputBody agentWorkflowUsageOutputBody = (AgentWorkflowUsageOutputBody) o; + return Objects.equals(this.report, agentWorkflowUsageOutputBody.report)&& + Objects.equals(this.additionalProperties, agentWorkflowUsageOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(report, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AgentWorkflowUsageOutputBody {\n"); + sb.append(" report: ").append(toIndentedString(report)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("report")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("report")); + } + + /** + * 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 AgentWorkflowUsageOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AgentWorkflowUsageOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AgentWorkflowUsageOutputBody is not found in the empty JSON string", AgentWorkflowUsageOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AgentWorkflowUsageOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("report") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("report").isJsonArray() && !jsonObj.get("report").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `report` to be an array in the JSON string but got `%s`", jsonObj.get("report").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AgentWorkflowUsageOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AgentWorkflowUsageOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AgentWorkflowUsageOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AgentWorkflowUsageOutputBody 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 AgentWorkflowUsageOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AgentWorkflowUsageOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AgentWorkflowUsageOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AgentWorkflowUsageOutputBody + * @throws IOException if the JSON string is invalid with respect to AgentWorkflowUsageOutputBody + */ + public static AgentWorkflowUsageOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AgentWorkflowUsageOutputBody.class); + } + + /** + * Convert an instance of AgentWorkflowUsageOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AnalyseCapabilitiesBody.java b/src/main/java/ai/reveng/model/AnalyseCapabilitiesBody.java new file mode 100644 index 0000000..ff7a669 --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalyseCapabilitiesBody.java @@ -0,0 +1,286 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AnalyseCapabilitiesBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalyseCapabilitiesBody { + public static final String SERIALIZED_NAME_COMPLETED = "completed"; + @SerializedName(SERIALIZED_NAME_COMPLETED) + @javax.annotation.Nonnull + private Long completed; + + public AnalyseCapabilitiesBody() { + } + + public AnalyseCapabilitiesBody completed(@javax.annotation.Nonnull Long completed) { + this.completed = completed; + return this; + } + + /** + * ANALYSE_CAPABILITIES agent tasks completed that day + * @return completed + */ + @javax.annotation.Nonnull + public Long getCompleted() { + return completed; + } + + public void setCompleted(@javax.annotation.Nonnull Long completed) { + this.completed = completed; + } + + /** + * 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 AnalyseCapabilitiesBody instance itself + */ + public AnalyseCapabilitiesBody 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; + } + AnalyseCapabilitiesBody analyseCapabilitiesBody = (AnalyseCapabilitiesBody) o; + return Objects.equals(this.completed, analyseCapabilitiesBody.completed)&& + Objects.equals(this.additionalProperties, analyseCapabilitiesBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(completed, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalyseCapabilitiesBody {\n"); + sb.append(" completed: ").append(toIndentedString(completed)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("completed")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("completed")); + } + + /** + * 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 AnalyseCapabilitiesBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalyseCapabilitiesBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AnalyseCapabilitiesBody is not found in the empty JSON string", AnalyseCapabilitiesBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalyseCapabilitiesBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalyseCapabilitiesBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalyseCapabilitiesBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalyseCapabilitiesBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalyseCapabilitiesBody 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 AnalyseCapabilitiesBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalyseCapabilitiesBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalyseCapabilitiesBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalyseCapabilitiesBody + * @throws IOException if the JSON string is invalid with respect to AnalyseCapabilitiesBody + */ + public static AnalyseCapabilitiesBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalyseCapabilitiesBody.class); + } + + /** + * Convert an instance of AnalyseCapabilitiesBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AnalysisTagsOutputBody.java b/src/main/java/ai/reveng/model/AnalysisTagsOutputBody.java new file mode 100644 index 0000000..72c3fd1 --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisTagsOutputBody.java @@ -0,0 +1,303 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.AnalysisTagBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AnalysisTagsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisTagsOutputBody { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public AnalysisTagsOutputBody() { + } + + public AnalysisTagsOutputBody tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public AnalysisTagsOutputBody addTagsItem(AnalysisTagBody tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Every tag on the analysis' binary, of any origin + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AnalysisTagsOutputBody instance itself + */ + public AnalysisTagsOutputBody 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; + } + AnalysisTagsOutputBody analysisTagsOutputBody = (AnalysisTagsOutputBody) o; + return Objects.equals(this.tags, analysisTagsOutputBody.tags)&& + Objects.equals(this.additionalProperties, analysisTagsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisTagsOutputBody {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("tags")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("tags")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AnalysisTagsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisTagsOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AnalysisTagsOutputBody is not found in the empty JSON string", AnalysisTagsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisTagsOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("tags").isJsonArray() && !jsonObj.get("tags").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisTagsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisTagsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisTagsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisTagsOutputBody 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 AnalysisTagsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalysisTagsOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalysisTagsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisTagsOutputBody + * @throws IOException if the JSON string is invalid with respect to AnalysisTagsOutputBody + */ + public static AnalysisTagsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisTagsOutputBody.class); + } + + /** + * Convert an instance of AnalysisTagsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AnalysisXrefOutputBody.java b/src/main/java/ai/reveng/model/AnalysisXrefOutputBody.java new file mode 100644 index 0000000..02ee925 --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisXrefOutputBody.java @@ -0,0 +1,344 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.XrefFromBody; +import ai.reveng.model.XrefIntoBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * AnalysisXrefOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisXrefOutputBody { + public static final String SERIALIZED_NAME_XREF_FROM_LIST = "xref_from_list"; + @SerializedName(SERIALIZED_NAME_XREF_FROM_LIST) + @javax.annotation.Nullable + private List xrefFromList; + + public static final String SERIALIZED_NAME_XREF_TO_LIST = "xref_to_list"; + @SerializedName(SERIALIZED_NAME_XREF_TO_LIST) + @javax.annotation.Nullable + private List xrefToList; + + public AnalysisXrefOutputBody() { + } + + public AnalysisXrefOutputBody xrefFromList(@javax.annotation.Nullable List xrefFromList) { + this.xrefFromList = xrefFromList; + return this; + } + + public AnalysisXrefOutputBody addXrefFromListItem(XrefFromBody xrefFromListItem) { + if (this.xrefFromList == null) { + this.xrefFromList = new ArrayList<>(); + } + this.xrefFromList.add(xrefFromListItem); + return this; + } + + /** + * Xrefs that originate at the queried vaddr, one per target address + * @return xrefFromList + */ + @javax.annotation.Nullable + public List getXrefFromList() { + return xrefFromList; + } + + public void setXrefFromList(@javax.annotation.Nullable List xrefFromList) { + this.xrefFromList = xrefFromList; + } + + + public AnalysisXrefOutputBody xrefToList(@javax.annotation.Nullable List xrefToList) { + this.xrefToList = xrefToList; + return this; + } + + public AnalysisXrefOutputBody addXrefToListItem(XrefIntoBody xrefToListItem) { + if (this.xrefToList == null) { + this.xrefToList = new ArrayList<>(); + } + this.xrefToList.add(xrefToListItem); + return this; + } + + /** + * Xrefs that target the queried vaddr, one per referencing address + * @return xrefToList + */ + @javax.annotation.Nullable + public List getXrefToList() { + return xrefToList; + } + + public void setXrefToList(@javax.annotation.Nullable List xrefToList) { + this.xrefToList = xrefToList; + } + + /** + * 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 AnalysisXrefOutputBody instance itself + */ + public AnalysisXrefOutputBody 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; + } + AnalysisXrefOutputBody analysisXrefOutputBody = (AnalysisXrefOutputBody) o; + return Objects.equals(this.xrefFromList, analysisXrefOutputBody.xrefFromList) && + Objects.equals(this.xrefToList, analysisXrefOutputBody.xrefToList)&& + Objects.equals(this.additionalProperties, analysisXrefOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(xrefFromList, xrefToList, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisXrefOutputBody {\n"); + sb.append(" xrefFromList: ").append(toIndentedString(xrefFromList)).append("\n"); + sb.append(" xrefToList: ").append(toIndentedString(xrefToList)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("xref_from_list", "xref_to_list")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("xref_from_list", "xref_to_list")); + } + + /** + * 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 AnalysisXrefOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisXrefOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in AnalysisXrefOutputBody is not found in the empty JSON string", AnalysisXrefOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisXrefOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("xref_from_list") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("xref_from_list").isJsonArray() && !jsonObj.get("xref_from_list").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `xref_from_list` to be an array in the JSON string but got `%s`", jsonObj.get("xref_from_list").toString())); + } + // ensure the required json array is present + if (jsonObj.get("xref_to_list") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("xref_to_list").isJsonArray() && !jsonObj.get("xref_to_list").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `xref_to_list` to be an array in the JSON string but got `%s`", jsonObj.get("xref_to_list").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisXrefOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisXrefOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisXrefOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisXrefOutputBody 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 AnalysisXrefOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnalysisXrefOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalysisXrefOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisXrefOutputBody + * @throws IOException if the JSON string is invalid with respect to AnalysisXrefOutputBody + */ + public static AnalysisXrefOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisXrefOutputBody.class); + } + + /** + * Convert an instance of AnalysisXrefOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BinaryExternalsBody.java b/src/main/java/ai/reveng/model/BinaryExternalsBody.java new file mode 100644 index 0000000..a8dffa5 --- /dev/null +++ b/src/main/java/ai/reveng/model/BinaryExternalsBody.java @@ -0,0 +1,394 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * BinaryExternalsBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BinaryExternalsBody { + public static final String SERIALIZED_NAME_MB = "mb"; + @SerializedName(SERIALIZED_NAME_MB) + @javax.annotation.Nullable + private Object mb = null; + + public static final String SERIALIZED_NAME_MB_LAST_UPDATED = "mb_last_updated"; + @SerializedName(SERIALIZED_NAME_MB_LAST_UPDATED) + @javax.annotation.Nullable + private OffsetDateTime mbLastUpdated; + + public static final String SERIALIZED_NAME_SHA256_HASH = "sha_256_hash"; + @SerializedName(SERIALIZED_NAME_SHA256_HASH) + @javax.annotation.Nonnull + private String sha256Hash; + + public static final String SERIALIZED_NAME_VT = "vt"; + @SerializedName(SERIALIZED_NAME_VT) + @javax.annotation.Nullable + private Object vt = null; + + public static final String SERIALIZED_NAME_VT_LAST_UPDATED = "vt_last_updated"; + @SerializedName(SERIALIZED_NAME_VT_LAST_UPDATED) + @javax.annotation.Nonnull + private OffsetDateTime vtLastUpdated; + + public BinaryExternalsBody() { + } + + public BinaryExternalsBody mb(@javax.annotation.Nullable Object mb) { + this.mb = mb; + return this; + } + + /** + * Get mb + * @return mb + */ + @javax.annotation.Nullable + public Object getMb() { + return mb; + } + + public void setMb(@javax.annotation.Nullable Object mb) { + this.mb = mb; + } + + + public BinaryExternalsBody mbLastUpdated(@javax.annotation.Nullable OffsetDateTime mbLastUpdated) { + this.mbLastUpdated = mbLastUpdated; + return this; + } + + /** + * When the MalwareBazaar lookup last ran, null if never looked up + * @return mbLastUpdated + */ + @javax.annotation.Nullable + public OffsetDateTime getMbLastUpdated() { + return mbLastUpdated; + } + + public void setMbLastUpdated(@javax.annotation.Nullable OffsetDateTime mbLastUpdated) { + this.mbLastUpdated = mbLastUpdated; + } + + + public BinaryExternalsBody sha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + return this; + } + + /** + * SHA-256 hash the lookups were keyed by + * @return sha256Hash + */ + @javax.annotation.Nonnull + public String getSha256Hash() { + return sha256Hash; + } + + public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + } + + + public BinaryExternalsBody vt(@javax.annotation.Nullable Object vt) { + this.vt = vt; + return this; + } + + /** + * Get vt + * @return vt + */ + @javax.annotation.Nullable + public Object getVt() { + return vt; + } + + public void setVt(@javax.annotation.Nullable Object vt) { + this.vt = vt; + } + + + public BinaryExternalsBody vtLastUpdated(@javax.annotation.Nonnull OffsetDateTime vtLastUpdated) { + this.vtLastUpdated = vtLastUpdated; + return this; + } + + /** + * When the VirusTotal lookup last ran + * @return vtLastUpdated + */ + @javax.annotation.Nonnull + public OffsetDateTime getVtLastUpdated() { + return vtLastUpdated; + } + + public void setVtLastUpdated(@javax.annotation.Nonnull OffsetDateTime vtLastUpdated) { + this.vtLastUpdated = vtLastUpdated; + } + + /** + * 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 BinaryExternalsBody instance itself + */ + public BinaryExternalsBody 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; + } + BinaryExternalsBody binaryExternalsBody = (BinaryExternalsBody) o; + return Objects.equals(this.mb, binaryExternalsBody.mb) && + Objects.equals(this.mbLastUpdated, binaryExternalsBody.mbLastUpdated) && + Objects.equals(this.sha256Hash, binaryExternalsBody.sha256Hash) && + Objects.equals(this.vt, binaryExternalsBody.vt) && + Objects.equals(this.vtLastUpdated, binaryExternalsBody.vtLastUpdated)&& + Objects.equals(this.additionalProperties, binaryExternalsBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(mb, mbLastUpdated, sha256Hash, vt, vtLastUpdated, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BinaryExternalsBody {\n"); + sb.append(" mb: ").append(toIndentedString(mb)).append("\n"); + sb.append(" mbLastUpdated: ").append(toIndentedString(mbLastUpdated)).append("\n"); + sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); + sb.append(" vt: ").append(toIndentedString(vt)).append("\n"); + sb.append(" vtLastUpdated: ").append(toIndentedString(vtLastUpdated)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("mb", "mb_last_updated", "sha_256_hash", "vt", "vt_last_updated")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("mb", "mb_last_updated", "sha_256_hash", "vt", "vt_last_updated")); + } + + /** + * 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 BinaryExternalsBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BinaryExternalsBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BinaryExternalsBody is not found in the empty JSON string", BinaryExternalsBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BinaryExternalsBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("sha_256_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sha_256_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha_256_hash").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BinaryExternalsBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BinaryExternalsBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BinaryExternalsBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BinaryExternalsBody 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 BinaryExternalsBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BinaryExternalsBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BinaryExternalsBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of BinaryExternalsBody + * @throws IOException if the JSON string is invalid with respect to BinaryExternalsBody + */ + public static BinaryExternalsBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BinaryExternalsBody.class); + } + + /** + * Convert an instance of BinaryExternalsBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BinarySearchResultBody.java b/src/main/java/ai/reveng/model/BinarySearchResultBody.java new file mode 100644 index 0000000..d1dd8a1 --- /dev/null +++ b/src/main/java/ai/reveng/model/BinarySearchResultBody.java @@ -0,0 +1,523 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * BinarySearchResultBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BinarySearchResultBody { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + public static final String SERIALIZED_NAME_BINARY_ID = "binary_id"; + @SerializedName(SERIALIZED_NAME_BINARY_ID) + @javax.annotation.Nonnull + private Long binaryId; + + public static final String SERIALIZED_NAME_BINARY_NAME = "binary_name"; + @SerializedName(SERIALIZED_NAME_BINARY_NAME) + @javax.annotation.Nonnull + private String binaryName; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_MODEL_ID = "model_id"; + @SerializedName(SERIALIZED_NAME_MODEL_ID) + @javax.annotation.Nonnull + private Long modelId; + + public static final String SERIALIZED_NAME_MODEL_NAME = "model_name"; + @SerializedName(SERIALIZED_NAME_MODEL_NAME) + @javax.annotation.Nonnull + private String modelName; + + public static final String SERIALIZED_NAME_OWNED_BY = "owned_by"; + @SerializedName(SERIALIZED_NAME_OWNED_BY) + @javax.annotation.Nonnull + private String ownedBy; + + public static final String SERIALIZED_NAME_SHA256_HASH = "sha_256_hash"; + @SerializedName(SERIALIZED_NAME_SHA256_HASH) + @javax.annotation.Nonnull + private String sha256Hash; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public BinarySearchResultBody() { + } + + public BinarySearchResultBody analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * Get analysisId + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public BinarySearchResultBody binaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + return this; + } + + /** + * Get binaryId + * @return binaryId + */ + @javax.annotation.Nonnull + public Long getBinaryId() { + return binaryId; + } + + public void setBinaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + } + + + public BinarySearchResultBody binaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + return this; + } + + /** + * Get binaryName + * @return binaryName + */ + @javax.annotation.Nonnull + public String getBinaryName() { + return binaryName; + } + + public void setBinaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + } + + + public BinarySearchResultBody createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BinarySearchResultBody modelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + return this; + } + + /** + * Get modelId + * @return modelId + */ + @javax.annotation.Nonnull + public Long getModelId() { + return modelId; + } + + public void setModelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + } + + + public BinarySearchResultBody modelName(@javax.annotation.Nonnull String modelName) { + this.modelName = modelName; + return this; + } + + /** + * Get modelName + * @return modelName + */ + @javax.annotation.Nonnull + public String getModelName() { + return modelName; + } + + public void setModelName(@javax.annotation.Nonnull String modelName) { + this.modelName = modelName; + } + + + public BinarySearchResultBody ownedBy(@javax.annotation.Nonnull String ownedBy) { + this.ownedBy = ownedBy; + return this; + } + + /** + * Get ownedBy + * @return ownedBy + */ + @javax.annotation.Nonnull + public String getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(@javax.annotation.Nonnull String ownedBy) { + this.ownedBy = ownedBy; + } + + + public BinarySearchResultBody sha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + return this; + } + + /** + * Get sha256Hash + * @return sha256Hash + */ + @javax.annotation.Nonnull + public String getSha256Hash() { + return sha256Hash; + } + + public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + } + + + public BinarySearchResultBody tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public BinarySearchResultBody addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BinarySearchResultBody instance itself + */ + public BinarySearchResultBody 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; + } + BinarySearchResultBody binarySearchResultBody = (BinarySearchResultBody) o; + return Objects.equals(this.analysisId, binarySearchResultBody.analysisId) && + Objects.equals(this.binaryId, binarySearchResultBody.binaryId) && + Objects.equals(this.binaryName, binarySearchResultBody.binaryName) && + Objects.equals(this.createdAt, binarySearchResultBody.createdAt) && + Objects.equals(this.modelId, binarySearchResultBody.modelId) && + Objects.equals(this.modelName, binarySearchResultBody.modelName) && + Objects.equals(this.ownedBy, binarySearchResultBody.ownedBy) && + Objects.equals(this.sha256Hash, binarySearchResultBody.sha256Hash) && + Objects.equals(this.tags, binarySearchResultBody.tags)&& + Objects.equals(this.additionalProperties, binarySearchResultBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analysisId, binaryId, binaryName, createdAt, modelId, modelName, ownedBy, sha256Hash, tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BinarySearchResultBody {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" binaryId: ").append(toIndentedString(binaryId)).append("\n"); + sb.append(" binaryName: ").append(toIndentedString(binaryName)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append(" modelName: ").append(toIndentedString(modelName)).append("\n"); + sb.append(" ownedBy: ").append(toIndentedString(ownedBy)).append("\n"); + sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analysis_id", "binary_id", "binary_name", "created_at", "model_id", "model_name", "owned_by", "sha_256_hash", "tags")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "binary_id", "binary_name", "created_at", "model_id", "model_name", "owned_by", "sha_256_hash", "tags")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BinarySearchResultBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BinarySearchResultBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BinarySearchResultBody is not found in the empty JSON string", BinarySearchResultBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BinarySearchResultBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("binary_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `binary_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("binary_name").toString())); + } + if (!jsonObj.get("model_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `model_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model_name").toString())); + } + if (!jsonObj.get("owned_by").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `owned_by` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owned_by").toString())); + } + if (!jsonObj.get("sha_256_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sha_256_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha_256_hash").toString())); + } + // ensure the required json array is present + if (jsonObj.get("tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("tags").isJsonArray() && !jsonObj.get("tags").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BinarySearchResultBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BinarySearchResultBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BinarySearchResultBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BinarySearchResultBody 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 BinarySearchResultBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BinarySearchResultBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BinarySearchResultBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of BinarySearchResultBody + * @throws IOException if the JSON string is invalid with respect to BinarySearchResultBody + */ + public static BinarySearchResultBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BinarySearchResultBody.class); + } + + /** + * Convert an instance of BinarySearchResultBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BulkAddTagsInputBody.java b/src/main/java/ai/reveng/model/BulkAddTagsInputBody.java new file mode 100644 index 0000000..f58ce30 --- /dev/null +++ b/src/main/java/ai/reveng/model/BulkAddTagsInputBody.java @@ -0,0 +1,342 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * BulkAddTagsInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BulkAddTagsInputBody { + public static final String SERIALIZED_NAME_ANALYSIS_IDS = "analysis_ids"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_IDS) + @javax.annotation.Nullable + private List analysisIds; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public BulkAddTagsInputBody() { + } + + public BulkAddTagsInputBody analysisIds(@javax.annotation.Nullable List analysisIds) { + this.analysisIds = analysisIds; + return this; + } + + public BulkAddTagsInputBody addAnalysisIdsItem(Long analysisIdsItem) { + if (this.analysisIds == null) { + this.analysisIds = new ArrayList<>(); + } + this.analysisIds.add(analysisIdsItem); + return this; + } + + /** + * IDs of the analyses to tag. The caller must own every one, or none are changed + * @return analysisIds + */ + @javax.annotation.Nullable + public List getAnalysisIds() { + return analysisIds; + } + + public void setAnalysisIds(@javax.annotation.Nullable List analysisIds) { + this.analysisIds = analysisIds; + } + + + public BulkAddTagsInputBody tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public BulkAddTagsInputBody addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags to add. A binary that already carries a tag, under any origin, is left as-is for that name + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BulkAddTagsInputBody instance itself + */ + public BulkAddTagsInputBody 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; + } + BulkAddTagsInputBody bulkAddTagsInputBody = (BulkAddTagsInputBody) o; + return Objects.equals(this.analysisIds, bulkAddTagsInputBody.analysisIds) && + Objects.equals(this.tags, bulkAddTagsInputBody.tags)&& + Objects.equals(this.additionalProperties, bulkAddTagsInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analysisIds, tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkAddTagsInputBody {\n"); + sb.append(" analysisIds: ").append(toIndentedString(analysisIds)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analysis_ids", "tags")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analysis_ids", "tags")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BulkAddTagsInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkAddTagsInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BulkAddTagsInputBody is not found in the empty JSON string", BulkAddTagsInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BulkAddTagsInputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("analysis_ids") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("analysis_ids").isJsonArray() && !jsonObj.get("analysis_ids").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `analysis_ids` to be an array in the JSON string but got `%s`", jsonObj.get("analysis_ids").toString())); + } + // ensure the required json array is present + if (jsonObj.get("tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("tags").isJsonArray() && !jsonObj.get("tags").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkAddTagsInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkAddTagsInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkAddTagsInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkAddTagsInputBody 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 BulkAddTagsInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BulkAddTagsInputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BulkAddTagsInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkAddTagsInputBody + * @throws IOException if the JSON string is invalid with respect to BulkAddTagsInputBody + */ + public static BulkAddTagsInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkAddTagsInputBody.class); + } + + /** + * Convert an instance of BulkAddTagsInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BulkAddTagsOutputBody.java b/src/main/java/ai/reveng/model/BulkAddTagsOutputBody.java new file mode 100644 index 0000000..37bac4e --- /dev/null +++ b/src/main/java/ai/reveng/model/BulkAddTagsOutputBody.java @@ -0,0 +1,303 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.BulkAddTagsResultBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * BulkAddTagsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BulkAddTagsOutputBody { + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) + @javax.annotation.Nullable + private List results; + + public BulkAddTagsOutputBody() { + } + + public BulkAddTagsOutputBody results(@javax.annotation.Nullable List results) { + this.results = results; + return this; + } + + public BulkAddTagsOutputBody addResultsItem(BulkAddTagsResultBody resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * One entry per requested analysis, in the order they were given + * @return results + */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + public void setResults(@javax.annotation.Nullable List results) { + this.results = results; + } + + /** + * 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 BulkAddTagsOutputBody instance itself + */ + public BulkAddTagsOutputBody 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; + } + BulkAddTagsOutputBody bulkAddTagsOutputBody = (BulkAddTagsOutputBody) o; + return Objects.equals(this.results, bulkAddTagsOutputBody.results)&& + Objects.equals(this.additionalProperties, bulkAddTagsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(results, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkAddTagsOutputBody {\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("results")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("results")); + } + + /** + * 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 BulkAddTagsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkAddTagsOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BulkAddTagsOutputBody is not found in the empty JSON string", BulkAddTagsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BulkAddTagsOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("results") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("results").isJsonArray() && !jsonObj.get("results").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkAddTagsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkAddTagsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkAddTagsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkAddTagsOutputBody 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 BulkAddTagsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BulkAddTagsOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BulkAddTagsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkAddTagsOutputBody + * @throws IOException if the JSON string is invalid with respect to BulkAddTagsOutputBody + */ + public static BulkAddTagsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkAddTagsOutputBody.class); + } + + /** + * Convert an instance of BulkAddTagsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BulkAddTagsResultBody.java b/src/main/java/ai/reveng/model/BulkAddTagsResultBody.java new file mode 100644 index 0000000..eb771af --- /dev/null +++ b/src/main/java/ai/reveng/model/BulkAddTagsResultBody.java @@ -0,0 +1,328 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * BulkAddTagsResultBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BulkAddTagsResultBody { + public static final String SERIALIZED_NAME_ADDED_TAGS = "added_tags"; + @SerializedName(SERIALIZED_NAME_ADDED_TAGS) + @javax.annotation.Nullable + private List addedTags; + + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + public BulkAddTagsResultBody() { + } + + public BulkAddTagsResultBody addedTags(@javax.annotation.Nullable List addedTags) { + this.addedTags = addedTags; + return this; + } + + public BulkAddTagsResultBody addAddedTagsItem(String addedTagsItem) { + if (this.addedTags == null) { + this.addedTags = new ArrayList<>(); + } + this.addedTags.add(addedTagsItem); + return this; + } + + /** + * Tags actually added; empty when the binary already carried every requested name + * @return addedTags + */ + @javax.annotation.Nullable + public List getAddedTags() { + return addedTags; + } + + public void setAddedTags(@javax.annotation.Nullable List addedTags) { + this.addedTags = addedTags; + } + + + public BulkAddTagsResultBody analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * ID of the analysis + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + /** + * 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 BulkAddTagsResultBody instance itself + */ + public BulkAddTagsResultBody 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; + } + BulkAddTagsResultBody bulkAddTagsResultBody = (BulkAddTagsResultBody) o; + return Objects.equals(this.addedTags, bulkAddTagsResultBody.addedTags) && + Objects.equals(this.analysisId, bulkAddTagsResultBody.analysisId)&& + Objects.equals(this.additionalProperties, bulkAddTagsResultBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addedTags, analysisId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkAddTagsResultBody {\n"); + sb.append(" addedTags: ").append(toIndentedString(addedTags)).append("\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("added_tags", "analysis_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("added_tags", "analysis_id")); + } + + /** + * 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 BulkAddTagsResultBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkAddTagsResultBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in BulkAddTagsResultBody is not found in the empty JSON string", BulkAddTagsResultBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BulkAddTagsResultBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("added_tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("added_tags").isJsonArray() && !jsonObj.get("added_tags").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `added_tags` to be an array in the JSON string but got `%s`", jsonObj.get("added_tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkAddTagsResultBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkAddTagsResultBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkAddTagsResultBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkAddTagsResultBody 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 BulkAddTagsResultBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BulkAddTagsResultBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BulkAddTagsResultBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkAddTagsResultBody + * @throws IOException if the JSON string is invalid with respect to BulkAddTagsResultBody + */ + public static BulkAddTagsResultBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkAddTagsResultBody.class); + } + + /** + * Convert an instance of BulkAddTagsResultBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateURLRequest.java b/src/main/java/ai/reveng/model/CreateURLRequest.java new file mode 100644 index 0000000..b224779 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateURLRequest.java @@ -0,0 +1,378 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * CreateURLRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateURLRequest { + /** + * Gets or Sets analysisScope + */ + @JsonAdapter(AnalysisScopeEnum.Adapter.class) + public enum AnalysisScopeEnum { + PRIVATE("PRIVATE"), + + PUBLIC("PUBLIC"), + + TEAM("TEAM"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + AnalysisScopeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AnalysisScopeEnum fromValue(String value) { + for (AnalysisScopeEnum b : AnalysisScopeEnum.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 AnalysisScopeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public AnalysisScopeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AnalysisScopeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AnalysisScopeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ANALYSIS_SCOPE = "analysis_scope"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_SCOPE) + @javax.annotation.Nullable + private AnalysisScopeEnum analysisScope = AnalysisScopeEnum.PRIVATE; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nonnull + private String url; + + public CreateURLRequest() { + } + + public CreateURLRequest analysisScope(@javax.annotation.Nullable AnalysisScopeEnum analysisScope) { + this.analysisScope = analysisScope; + return this; + } + + /** + * Get analysisScope + * @return analysisScope + */ + @javax.annotation.Nullable + public AnalysisScopeEnum getAnalysisScope() { + return analysisScope; + } + + public void setAnalysisScope(@javax.annotation.Nullable AnalysisScopeEnum analysisScope) { + this.analysisScope = analysisScope; + } + + + public CreateURLRequest url(@javax.annotation.Nonnull String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(@javax.annotation.Nonnull String url) { + this.url = url; + } + + /** + * 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 CreateURLRequest instance itself + */ + public CreateURLRequest 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; + } + CreateURLRequest createURLRequest = (CreateURLRequest) o; + return Objects.equals(this.analysisScope, createURLRequest.analysisScope) && + Objects.equals(this.url, createURLRequest.url)&& + Objects.equals(this.additionalProperties, createURLRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analysisScope, url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateURLRequest {\n"); + sb.append(" analysisScope: ").append(toIndentedString(analysisScope)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analysis_scope", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("url")); + } + + /** + * 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 CreateURLRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateURLRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CreateURLRequest is not found in the empty JSON string", CreateURLRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateURLRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("analysis_scope") != null && !jsonObj.get("analysis_scope").isJsonNull()) && !jsonObj.get("analysis_scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `analysis_scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("analysis_scope").toString())); + } + // validate the optional field `analysis_scope` + if (jsonObj.get("analysis_scope") != null && !jsonObj.get("analysis_scope").isJsonNull()) { + AnalysisScopeEnum.validateJsonElement(jsonObj.get("analysis_scope")); + } + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateURLRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateURLRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateURLRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateURLRequest 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 CreateURLRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateURLRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateURLRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateURLRequest + * @throws IOException if the JSON string is invalid with respect to CreateURLRequest + */ + public static CreateURLRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateURLRequest.class); + } + + /** + * Convert an instance of CreateURLRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateURLResponse.java b/src/main/java/ai/reveng/model/CreateURLResponse.java new file mode 100644 index 0000000..c101dd9 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateURLResponse.java @@ -0,0 +1,341 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * CreateURLResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateURLResponse { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + public static final String SERIALIZED_NAME_BINARY_ID = "binary_id"; + @SerializedName(SERIALIZED_NAME_BINARY_ID) + @javax.annotation.Nonnull + private Long binaryId; + + public static final String SERIALIZED_NAME_SHA256_HASH = "sha_256_hash"; + @SerializedName(SERIALIZED_NAME_SHA256_HASH) + @javax.annotation.Nonnull + private String sha256Hash; + + public CreateURLResponse() { + } + + public CreateURLResponse analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * Get analysisId + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public CreateURLResponse binaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + return this; + } + + /** + * Get binaryId + * @return binaryId + */ + @javax.annotation.Nonnull + public Long getBinaryId() { + return binaryId; + } + + public void setBinaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + } + + + public CreateURLResponse sha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + return this; + } + + /** + * Get sha256Hash + * @return sha256Hash + */ + @javax.annotation.Nonnull + public String getSha256Hash() { + return sha256Hash; + } + + public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + } + + /** + * 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 CreateURLResponse instance itself + */ + public CreateURLResponse 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; + } + CreateURLResponse createURLResponse = (CreateURLResponse) o; + return Objects.equals(this.analysisId, createURLResponse.analysisId) && + Objects.equals(this.binaryId, createURLResponse.binaryId) && + Objects.equals(this.sha256Hash, createURLResponse.sha256Hash)&& + Objects.equals(this.additionalProperties, createURLResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analysisId, binaryId, sha256Hash, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateURLResponse {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" binaryId: ").append(toIndentedString(binaryId)).append("\n"); + sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analysis_id", "binary_id", "sha_256_hash")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "binary_id", "sha_256_hash")); + } + + /** + * 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 CreateURLResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateURLResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CreateURLResponse is not found in the empty JSON string", CreateURLResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateURLResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("sha_256_hash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sha_256_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sha_256_hash").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateURLResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateURLResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateURLResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateURLResponse 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 CreateURLResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateURLResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateURLResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateURLResponse + * @throws IOException if the JSON string is invalid with respect to CreateURLResponse + */ + public static CreateURLResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateURLResponse.class); + } + + /** + * Convert an instance of CreateURLResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateUserInputBody.java b/src/main/java/ai/reveng/model/CreateUserInputBody.java index 28740ee..8762741 100644 --- a/src/main/java/ai/reveng/model/CreateUserInputBody.java +++ b/src/main/java/ai/reveng/model/CreateUserInputBody.java @@ -135,6 +135,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nullable private RoleEnum role; + public static final String SERIALIZED_NAME_TEAM_ID = "team_id"; + @SerializedName(SERIALIZED_NAME_TEAM_ID) + @javax.annotation.Nullable + private Long teamId; + /** * User tier (defaults to ENTHUSIAST) */ @@ -328,6 +333,26 @@ public void setRole(@javax.annotation.Nullable RoleEnum role) { } + public CreateUserInputBody teamId(@javax.annotation.Nullable Long teamId) { + this.teamId = teamId; + return this; + } + + /** + * Existing team to add the user to, which also becomes their default team + * minimum: 1 + * @return teamId + */ + @javax.annotation.Nullable + public Long getTeamId() { + return teamId; + } + + public void setTeamId(@javax.annotation.Nullable Long teamId) { + this.teamId = teamId; + } + + public CreateUserInputBody tier(@javax.annotation.Nullable TierEnum tier) { this.tier = tier; return this; @@ -445,6 +470,7 @@ public boolean equals(Object o) { Objects.equals(this.lastName, createUserInputBody.lastName) && Objects.equals(this.password, createUserInputBody.password) && Objects.equals(this.role, createUserInputBody.role) && + Objects.equals(this.teamId, createUserInputBody.teamId) && Objects.equals(this.tier, createUserInputBody.tier) && Objects.equals(this.timeZone, createUserInputBody.timeZone) && Objects.equals(this.username, createUserInputBody.username)&& @@ -453,7 +479,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(credits, email, firstName, lastName, password, role, tier, timeZone, username, additionalProperties); + return Objects.hash(credits, email, firstName, lastName, password, role, teamId, tier, timeZone, username, additionalProperties); } @Override @@ -466,6 +492,7 @@ public String toString() { sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" teamId: ").append(toIndentedString(teamId)).append("\n"); sb.append(" tier: ").append(toIndentedString(tier)).append("\n"); sb.append(" timeZone: ").append(toIndentedString(timeZone)).append("\n"); sb.append(" username: ").append(toIndentedString(username)).append("\n"); @@ -488,7 +515,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("credits", "email", "first_name", "last_name", "password", "role", "tier", "time_zone", "username")); + openapiFields = new HashSet(Arrays.asList("credits", "email", "first_name", "last_name", "password", "role", "team_id", "tier", "time_zone", "username")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("email", "password", "username")); diff --git a/src/main/java/ai/reveng/model/CryptoFinding.java b/src/main/java/ai/reveng/model/CryptoFinding.java index 01e818f..2642b13 100644 --- a/src/main/java/ai/reveng/model/CryptoFinding.java +++ b/src/main/java/ai/reveng/model/CryptoFinding.java @@ -15,6 +15,7 @@ import java.util.Objects; import ai.reveng.model.CryptoCall; import ai.reveng.model.CryptoDirectMatch; +import ai.reveng.model.CryptoVerification; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -290,6 +291,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nullable private List libraries; + public static final String SERIALIZED_NAME_VERIFICATION = "verification"; + @SerializedName(SERIALIZED_NAME_VERIFICATION) + @javax.annotation.Nullable + private CryptoVerification verification; + public CryptoFinding() { } @@ -514,6 +520,25 @@ public void setLibraries(@javax.annotation.Nullable List librarie this.libraries = libraries; } + + public CryptoFinding verification(@javax.annotation.Nullable CryptoVerification verification) { + this.verification = verification; + return this; + } + + /** + * LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. + * @return verification + */ + @javax.annotation.Nullable + public CryptoVerification getVerification() { + return verification; + } + + public void setVerification(@javax.annotation.Nullable CryptoVerification verification) { + this.verification = verification; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -578,7 +603,8 @@ public boolean equals(Object o) { Objects.equals(this.functionId, cryptoFinding.functionId) && Objects.equals(this.functionName, cryptoFinding.functionName) && Objects.equals(this.functionSize, cryptoFinding.functionSize) && - Objects.equals(this.libraries, cryptoFinding.libraries)&& + Objects.equals(this.libraries, cryptoFinding.libraries) && + Objects.equals(this.verification, cryptoFinding.verification)&& Objects.equals(this.additionalProperties, cryptoFinding.additionalProperties); } @@ -588,7 +614,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(address, categories, confidence, cryptoCalls, directMatches, evidenceCount, functionId, functionName, functionSize, libraries, additionalProperties); + return Objects.hash(address, categories, confidence, cryptoCalls, directMatches, evidenceCount, functionId, functionName, functionSize, libraries, verification, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -612,6 +638,7 @@ public String toString() { sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); sb.append(" functionSize: ").append(toIndentedString(functionSize)).append("\n"); sb.append(" libraries: ").append(toIndentedString(libraries)).append("\n"); + sb.append(" verification: ").append(toIndentedString(verification)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -631,7 +658,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "crypto_calls", "direct_matches", "evidence_count", "function_id", "function_name", "function_size", "libraries")); + openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "crypto_calls", "direct_matches", "evidence_count", "function_id", "function_name", "function_size", "libraries", "verification")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("address", "categories", "confidence", "evidence_count", "function_id", "function_name", "function_size", "libraries")); diff --git a/src/main/java/ai/reveng/model/CryptoVerification.java b/src/main/java/ai/reveng/model/CryptoVerification.java new file mode 100644 index 0000000..694c8ca --- /dev/null +++ b/src/main/java/ai/reveng/model/CryptoVerification.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * CryptoVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CryptoVerification { + /** + * LLM's confidence in the verdict. Absent when verified is null. + */ + @JsonAdapter(ConfidenceEnum.Adapter.class) + public enum ConfidenceEnum { + HIGH("high"), + + MEDIUM("medium"), + + LOW("low"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ConfidenceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConfidenceEnum fromValue(String value) { + for (ConfidenceEnum b : ConfidenceEnum.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 ConfidenceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConfidenceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConfidenceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConfidenceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CONFIDENCE = "confidence"; + @SerializedName(SERIALIZED_NAME_CONFIDENCE) + @javax.annotation.Nullable + private ConfidenceEnum confidence; + + public static final String SERIALIZED_NAME_REASONING = "reasoning"; + @SerializedName(SERIALIZED_NAME_REASONING) + @javax.annotation.Nonnull + private String reasoning; + + public static final String SERIALIZED_NAME_VERIFIED = "verified"; + @SerializedName(SERIALIZED_NAME_VERIFIED) + @javax.annotation.Nullable + private Boolean verified; + + public CryptoVerification() { + } + + public CryptoVerification confidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + return this; + } + + /** + * LLM's confidence in the verdict. Absent when verified is null. + * @return confidence + */ + @javax.annotation.Nullable + public ConfidenceEnum getConfidence() { + return confidence; + } + + public void setConfidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + } + + + public CryptoVerification reasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + * LLM's explanation for the verdict, or the reason verification could not be completed + * @return reasoning + */ + @javax.annotation.Nonnull + public String getReasoning() { + return reasoning; + } + + public void setReasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + } + + + public CryptoVerification verified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + return this; + } + + /** + * Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped + * @return verified + */ + @javax.annotation.Nullable + public Boolean getVerified() { + return verified; + } + + public void setVerified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + } + + /** + * 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 CryptoVerification instance itself + */ + public CryptoVerification 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; + } + CryptoVerification cryptoVerification = (CryptoVerification) o; + return Objects.equals(this.confidence, cryptoVerification.confidence) && + Objects.equals(this.reasoning, cryptoVerification.reasoning) && + Objects.equals(this.verified, cryptoVerification.verified)&& + Objects.equals(this.additionalProperties, cryptoVerification.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(confidence, reasoning, verified, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CryptoVerification {\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" reasoning: ").append(toIndentedString(reasoning)).append("\n"); + sb.append(" verified: ").append(toIndentedString(verified)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("confidence", "reasoning", "verified")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("reasoning", "verified")); + } + + /** + * 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 CryptoVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CryptoVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in CryptoVerification is not found in the empty JSON string", CryptoVerification.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CryptoVerification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) && !jsonObj.get("confidence").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `confidence` to be a primitive type in the JSON string but got `%s`", jsonObj.get("confidence").toString())); + } + // validate the optional field `confidence` + if (jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) { + ConfidenceEnum.validateJsonElement(jsonObj.get("confidence")); + } + if (!jsonObj.get("reasoning").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reasoning` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasoning").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CryptoVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CryptoVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CryptoVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CryptoVerification 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 CryptoVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CryptoVerification instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CryptoVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of CryptoVerification + * @throws IOException if the JSON string is invalid with respect to CryptoVerification + */ + public static CryptoVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CryptoVerification.class); + } + + /** + * Convert an instance of CryptoVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DailyAnalysesCountOutputBody.java b/src/main/java/ai/reveng/model/DailyAnalysesCountOutputBody.java new file mode 100644 index 0000000..871629f --- /dev/null +++ b/src/main/java/ai/reveng/model/DailyAnalysesCountOutputBody.java @@ -0,0 +1,303 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.DailyCountBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * DailyAnalysesCountOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DailyAnalysesCountOutputBody { + public static final String SERIALIZED_NAME_DAILY_COUNTS = "daily_counts"; + @SerializedName(SERIALIZED_NAME_DAILY_COUNTS) + @javax.annotation.Nullable + private List dailyCounts; + + public DailyAnalysesCountOutputBody() { + } + + public DailyAnalysesCountOutputBody dailyCounts(@javax.annotation.Nullable List dailyCounts) { + this.dailyCounts = dailyCounts; + return this; + } + + public DailyAnalysesCountOutputBody addDailyCountsItem(DailyCountBody dailyCountsItem) { + if (this.dailyCounts == null) { + this.dailyCounts = new ArrayList<>(); + } + this.dailyCounts.add(dailyCountsItem); + return this; + } + + /** + * One entry per day of the last 31 days, oldest first + * @return dailyCounts + */ + @javax.annotation.Nullable + public List getDailyCounts() { + return dailyCounts; + } + + public void setDailyCounts(@javax.annotation.Nullable List dailyCounts) { + this.dailyCounts = dailyCounts; + } + + /** + * 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 DailyAnalysesCountOutputBody instance itself + */ + public DailyAnalysesCountOutputBody 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; + } + DailyAnalysesCountOutputBody dailyAnalysesCountOutputBody = (DailyAnalysesCountOutputBody) o; + return Objects.equals(this.dailyCounts, dailyAnalysesCountOutputBody.dailyCounts)&& + Objects.equals(this.additionalProperties, dailyAnalysesCountOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(dailyCounts, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DailyAnalysesCountOutputBody {\n"); + sb.append(" dailyCounts: ").append(toIndentedString(dailyCounts)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("daily_counts")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("daily_counts")); + } + + /** + * 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 DailyAnalysesCountOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DailyAnalysesCountOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DailyAnalysesCountOutputBody is not found in the empty JSON string", DailyAnalysesCountOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DailyAnalysesCountOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("daily_counts") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("daily_counts").isJsonArray() && !jsonObj.get("daily_counts").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `daily_counts` to be an array in the JSON string but got `%s`", jsonObj.get("daily_counts").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DailyAnalysesCountOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DailyAnalysesCountOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DailyAnalysesCountOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DailyAnalysesCountOutputBody 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 DailyAnalysesCountOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DailyAnalysesCountOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DailyAnalysesCountOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of DailyAnalysesCountOutputBody + * @throws IOException if the JSON string is invalid with respect to DailyAnalysesCountOutputBody + */ + public static DailyAnalysesCountOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DailyAnalysesCountOutputBody.class); + } + + /** + * Convert an instance of DailyAnalysesCountOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DailyCountBody.java b/src/main/java/ai/reveng/model/DailyCountBody.java new file mode 100644 index 0000000..bec012e --- /dev/null +++ b/src/main/java/ai/reveng/model/DailyCountBody.java @@ -0,0 +1,313 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * DailyCountBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DailyCountBody { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nonnull + private Long count; + + public static final String SERIALIZED_NAME_DAY = "day"; + @SerializedName(SERIALIZED_NAME_DAY) + @javax.annotation.Nonnull + private OffsetDateTime day; + + public DailyCountBody() { + } + + public DailyCountBody count(@javax.annotation.Nonnull Long count) { + this.count = count; + return this; + } + + /** + * Analyses the user created that day + * @return count + */ + @javax.annotation.Nonnull + public Long getCount() { + return count; + } + + public void setCount(@javax.annotation.Nonnull Long count) { + this.count = count; + } + + + public DailyCountBody day(@javax.annotation.Nonnull OffsetDateTime day) { + this.day = day; + return this; + } + + /** + * Day this count covers, at midnight UTC + * @return day + */ + @javax.annotation.Nonnull + public OffsetDateTime getDay() { + return day; + } + + public void setDay(@javax.annotation.Nonnull OffsetDateTime day) { + this.day = day; + } + + /** + * 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 DailyCountBody instance itself + */ + public DailyCountBody 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; + } + DailyCountBody dailyCountBody = (DailyCountBody) o; + return Objects.equals(this.count, dailyCountBody.count) && + Objects.equals(this.day, dailyCountBody.day)&& + Objects.equals(this.additionalProperties, dailyCountBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(count, day, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DailyCountBody {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" day: ").append(toIndentedString(day)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("count", "day")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("count", "day")); + } + + /** + * 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 DailyCountBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DailyCountBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in DailyCountBody is not found in the empty JSON string", DailyCountBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DailyCountBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DailyCountBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DailyCountBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DailyCountBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DailyCountBody 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 DailyCountBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DailyCountBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DailyCountBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of DailyCountBody + * @throws IOException if the JSON string is invalid with respect to DailyCountBody + */ + public static DailyCountBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DailyCountBody.class); + } + + /** + * Convert an instance of DailyCountBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ExecutionFinding.java b/src/main/java/ai/reveng/model/ExecutionFinding.java index 345ffa9..457aee1 100644 --- a/src/main/java/ai/reveng/model/ExecutionFinding.java +++ b/src/main/java/ai/reveng/model/ExecutionFinding.java @@ -15,6 +15,7 @@ import java.util.Objects; import ai.reveng.model.ExecutionCall; import ai.reveng.model.ExecutionDirectMatch; +import ai.reveng.model.ExecutionVerification; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -299,6 +300,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nullable private List sources; + public static final String SERIALIZED_NAME_VERIFICATION = "verification"; + @SerializedName(SERIALIZED_NAME_VERIFICATION) + @javax.annotation.Nullable + private ExecutionVerification verification; + public ExecutionFinding() { } @@ -542,6 +548,25 @@ public void setSources(@javax.annotation.Nullable List sources) { this.sources = sources; } + + public ExecutionFinding verification(@javax.annotation.Nullable ExecutionVerification verification) { + this.verification = verification; + return this; + } + + /** + * LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. + * @return verification + */ + @javax.annotation.Nullable + public ExecutionVerification getVerification() { + return verification; + } + + public void setVerification(@javax.annotation.Nullable ExecutionVerification verification) { + this.verification = verification; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -607,7 +632,8 @@ public boolean equals(Object o) { Objects.equals(this.functionId, executionFinding.functionId) && Objects.equals(this.functionName, executionFinding.functionName) && Objects.equals(this.functionSize, executionFinding.functionSize) && - Objects.equals(this.sources, executionFinding.sources)&& + Objects.equals(this.sources, executionFinding.sources) && + Objects.equals(this.verification, executionFinding.verification)&& Objects.equals(this.additionalProperties, executionFinding.additionalProperties); } @@ -617,7 +643,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(address, categories, confidence, directMatches, evidenceCount, executes, executionCalls, functionId, functionName, functionSize, sources, additionalProperties); + return Objects.hash(address, categories, confidence, directMatches, evidenceCount, executes, executionCalls, functionId, functionName, functionSize, sources, verification, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -642,6 +668,7 @@ public String toString() { sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); sb.append(" functionSize: ").append(toIndentedString(functionSize)).append("\n"); sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" verification: ").append(toIndentedString(verification)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -661,7 +688,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "direct_matches", "evidence_count", "executes", "execution_calls", "function_id", "function_name", "function_size", "sources")); + openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "direct_matches", "evidence_count", "executes", "execution_calls", "function_id", "function_name", "function_size", "sources", "verification")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("address", "categories", "confidence", "evidence_count", "executes", "function_id", "function_name", "function_size", "sources")); diff --git a/src/main/java/ai/reveng/model/ExecutionVerification.java b/src/main/java/ai/reveng/model/ExecutionVerification.java new file mode 100644 index 0000000..6812dd6 --- /dev/null +++ b/src/main/java/ai/reveng/model/ExecutionVerification.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * ExecutionVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ExecutionVerification { + /** + * LLM's confidence in the verdict. Absent when verified is null. + */ + @JsonAdapter(ConfidenceEnum.Adapter.class) + public enum ConfidenceEnum { + HIGH("high"), + + MEDIUM("medium"), + + LOW("low"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ConfidenceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConfidenceEnum fromValue(String value) { + for (ConfidenceEnum b : ConfidenceEnum.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 ConfidenceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConfidenceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConfidenceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConfidenceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CONFIDENCE = "confidence"; + @SerializedName(SERIALIZED_NAME_CONFIDENCE) + @javax.annotation.Nullable + private ConfidenceEnum confidence; + + public static final String SERIALIZED_NAME_REASONING = "reasoning"; + @SerializedName(SERIALIZED_NAME_REASONING) + @javax.annotation.Nonnull + private String reasoning; + + public static final String SERIALIZED_NAME_VERIFIED = "verified"; + @SerializedName(SERIALIZED_NAME_VERIFIED) + @javax.annotation.Nullable + private Boolean verified; + + public ExecutionVerification() { + } + + public ExecutionVerification confidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + return this; + } + + /** + * LLM's confidence in the verdict. Absent when verified is null. + * @return confidence + */ + @javax.annotation.Nullable + public ConfidenceEnum getConfidence() { + return confidence; + } + + public void setConfidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + } + + + public ExecutionVerification reasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + * LLM's explanation for the verdict, or the reason verification could not be completed + * @return reasoning + */ + @javax.annotation.Nonnull + public String getReasoning() { + return reasoning; + } + + public void setReasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + } + + + public ExecutionVerification verified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + return this; + } + + /** + * Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped + * @return verified + */ + @javax.annotation.Nullable + public Boolean getVerified() { + return verified; + } + + public void setVerified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + } + + /** + * 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 ExecutionVerification instance itself + */ + public ExecutionVerification 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; + } + ExecutionVerification executionVerification = (ExecutionVerification) o; + return Objects.equals(this.confidence, executionVerification.confidence) && + Objects.equals(this.reasoning, executionVerification.reasoning) && + Objects.equals(this.verified, executionVerification.verified)&& + Objects.equals(this.additionalProperties, executionVerification.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(confidence, reasoning, verified, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionVerification {\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" reasoning: ").append(toIndentedString(reasoning)).append("\n"); + sb.append(" verified: ").append(toIndentedString(verified)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("confidence", "reasoning", "verified")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("reasoning", "verified")); + } + + /** + * 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 ExecutionVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ExecutionVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ExecutionVerification is not found in the empty JSON string", ExecutionVerification.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ExecutionVerification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) && !jsonObj.get("confidence").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `confidence` to be a primitive type in the JSON string but got `%s`", jsonObj.get("confidence").toString())); + } + // validate the optional field `confidence` + if (jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) { + ConfidenceEnum.validateJsonElement(jsonObj.get("confidence")); + } + if (!jsonObj.get("reasoning").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reasoning` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasoning").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ExecutionVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ExecutionVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ExecutionVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ExecutionVerification 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 ExecutionVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ExecutionVerification instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ExecutionVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of ExecutionVerification + * @throws IOException if the JSON string is invalid with respect to ExecutionVerification + */ + public static ExecutionVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ExecutionVerification.class); + } + + /** + * Convert an instance of ExecutionVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FilesystemFinding.java b/src/main/java/ai/reveng/model/FilesystemFinding.java index 8c8d492..15d0005 100644 --- a/src/main/java/ai/reveng/model/FilesystemFinding.java +++ b/src/main/java/ai/reveng/model/FilesystemFinding.java @@ -15,6 +15,7 @@ import java.util.Objects; import ai.reveng.model.FilesystemCall; import ai.reveng.model.FilesystemDirectMatch; +import ai.reveng.model.FilesystemVerification; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -309,6 +310,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nullable private List sources; + public static final String SERIALIZED_NAME_VERIFICATION = "verification"; + @SerializedName(SERIALIZED_NAME_VERIFICATION) + @javax.annotation.Nullable + private FilesystemVerification verification; + public FilesystemFinding() { } @@ -552,6 +558,25 @@ public void setSources(@javax.annotation.Nullable List sources) { this.sources = sources; } + + public FilesystemFinding verification(@javax.annotation.Nullable FilesystemVerification verification) { + this.verification = verification; + return this; + } + + /** + * LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. + * @return verification + */ + @javax.annotation.Nullable + public FilesystemVerification getVerification() { + return verification; + } + + public void setVerification(@javax.annotation.Nullable FilesystemVerification verification) { + this.verification = verification; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -617,7 +642,8 @@ public boolean equals(Object o) { Objects.equals(this.functionName, filesystemFinding.functionName) && Objects.equals(this.functionSize, filesystemFinding.functionSize) && Objects.equals(this.modifies, filesystemFinding.modifies) && - Objects.equals(this.sources, filesystemFinding.sources)&& + Objects.equals(this.sources, filesystemFinding.sources) && + Objects.equals(this.verification, filesystemFinding.verification)&& Objects.equals(this.additionalProperties, filesystemFinding.additionalProperties); } @@ -627,7 +653,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(address, categories, confidence, directMatches, evidenceCount, filesystemCalls, functionId, functionName, functionSize, modifies, sources, additionalProperties); + return Objects.hash(address, categories, confidence, directMatches, evidenceCount, filesystemCalls, functionId, functionName, functionSize, modifies, sources, verification, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -652,6 +678,7 @@ public String toString() { sb.append(" functionSize: ").append(toIndentedString(functionSize)).append("\n"); sb.append(" modifies: ").append(toIndentedString(modifies)).append("\n"); sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" verification: ").append(toIndentedString(verification)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -671,7 +698,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "direct_matches", "evidence_count", "filesystem_calls", "function_id", "function_name", "function_size", "modifies", "sources")); + openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "direct_matches", "evidence_count", "filesystem_calls", "function_id", "function_name", "function_size", "modifies", "sources", "verification")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("address", "categories", "confidence", "evidence_count", "function_id", "function_name", "function_size", "modifies", "sources")); diff --git a/src/main/java/ai/reveng/model/FilesystemVerification.java b/src/main/java/ai/reveng/model/FilesystemVerification.java new file mode 100644 index 0000000..2f13415 --- /dev/null +++ b/src/main/java/ai/reveng/model/FilesystemVerification.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * FilesystemVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FilesystemVerification { + /** + * LLM's confidence in the verdict. Absent when verified is null. + */ + @JsonAdapter(ConfidenceEnum.Adapter.class) + public enum ConfidenceEnum { + HIGH("high"), + + MEDIUM("medium"), + + LOW("low"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ConfidenceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConfidenceEnum fromValue(String value) { + for (ConfidenceEnum b : ConfidenceEnum.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 ConfidenceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConfidenceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConfidenceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConfidenceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CONFIDENCE = "confidence"; + @SerializedName(SERIALIZED_NAME_CONFIDENCE) + @javax.annotation.Nullable + private ConfidenceEnum confidence; + + public static final String SERIALIZED_NAME_REASONING = "reasoning"; + @SerializedName(SERIALIZED_NAME_REASONING) + @javax.annotation.Nonnull + private String reasoning; + + public static final String SERIALIZED_NAME_VERIFIED = "verified"; + @SerializedName(SERIALIZED_NAME_VERIFIED) + @javax.annotation.Nullable + private Boolean verified; + + public FilesystemVerification() { + } + + public FilesystemVerification confidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + return this; + } + + /** + * LLM's confidence in the verdict. Absent when verified is null. + * @return confidence + */ + @javax.annotation.Nullable + public ConfidenceEnum getConfidence() { + return confidence; + } + + public void setConfidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + } + + + public FilesystemVerification reasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + * LLM's explanation for the verdict, or the reason verification could not be completed + * @return reasoning + */ + @javax.annotation.Nonnull + public String getReasoning() { + return reasoning; + } + + public void setReasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + } + + + public FilesystemVerification verified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + return this; + } + + /** + * Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped + * @return verified + */ + @javax.annotation.Nullable + public Boolean getVerified() { + return verified; + } + + public void setVerified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + } + + /** + * 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 FilesystemVerification instance itself + */ + public FilesystemVerification 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; + } + FilesystemVerification filesystemVerification = (FilesystemVerification) o; + return Objects.equals(this.confidence, filesystemVerification.confidence) && + Objects.equals(this.reasoning, filesystemVerification.reasoning) && + Objects.equals(this.verified, filesystemVerification.verified)&& + Objects.equals(this.additionalProperties, filesystemVerification.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(confidence, reasoning, verified, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FilesystemVerification {\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" reasoning: ").append(toIndentedString(reasoning)).append("\n"); + sb.append(" verified: ").append(toIndentedString(verified)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("confidence", "reasoning", "verified")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("reasoning", "verified")); + } + + /** + * 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 FilesystemVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FilesystemVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FilesystemVerification is not found in the empty JSON string", FilesystemVerification.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FilesystemVerification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) && !jsonObj.get("confidence").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `confidence` to be a primitive type in the JSON string but got `%s`", jsonObj.get("confidence").toString())); + } + // validate the optional field `confidence` + if (jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) { + ConfidenceEnum.validateJsonElement(jsonObj.get("confidence")); + } + if (!jsonObj.get("reasoning").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reasoning` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasoning").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FilesystemVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FilesystemVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FilesystemVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FilesystemVerification 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 FilesystemVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FilesystemVerification instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FilesystemVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of FilesystemVerification + * @throws IOException if the JSON string is invalid with respect to FilesystemVerification + */ + public static FilesystemVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FilesystemVerification.class); + } + + /** + * Convert an instance of FilesystemVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionSearchResultBody.java b/src/main/java/ai/reveng/model/FunctionSearchResultBody.java new file mode 100644 index 0000000..8376993 --- /dev/null +++ b/src/main/java/ai/reveng/model/FunctionSearchResultBody.java @@ -0,0 +1,455 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * FunctionSearchResultBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FunctionSearchResultBody { + public static final String SERIALIZED_NAME_BINARY_NAME = "binary_name"; + @SerializedName(SERIALIZED_NAME_BINARY_NAME) + @javax.annotation.Nonnull + private String binaryName; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nonnull + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nonnull + private Long functionId; + + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; + + public static final String SERIALIZED_NAME_MODEL_ID = "model_id"; + @SerializedName(SERIALIZED_NAME_MODEL_ID) + @javax.annotation.Nonnull + private Long modelId; + + public static final String SERIALIZED_NAME_MODEL_NAME = "model_name"; + @SerializedName(SERIALIZED_NAME_MODEL_NAME) + @javax.annotation.Nonnull + private String modelName; + + public static final String SERIALIZED_NAME_OWNED_BY = "owned_by"; + @SerializedName(SERIALIZED_NAME_OWNED_BY) + @javax.annotation.Nonnull + private String ownedBy; + + public FunctionSearchResultBody() { + } + + public FunctionSearchResultBody binaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + return this; + } + + /** + * Get binaryName + * @return binaryName + */ + @javax.annotation.Nonnull + public String getBinaryName() { + return binaryName; + } + + public void setBinaryName(@javax.annotation.Nonnull String binaryName) { + this.binaryName = binaryName; + } + + + public FunctionSearchResultBody createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public FunctionSearchResultBody functionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + return this; + } + + /** + * Get functionId + * @return functionId + */ + @javax.annotation.Nonnull + public Long getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + } + + + public FunctionSearchResultBody functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get functionName + * @return functionName + */ + @javax.annotation.Nonnull + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + } + + + public FunctionSearchResultBody modelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + return this; + } + + /** + * Get modelId + * @return modelId + */ + @javax.annotation.Nonnull + public Long getModelId() { + return modelId; + } + + public void setModelId(@javax.annotation.Nonnull Long modelId) { + this.modelId = modelId; + } + + + public FunctionSearchResultBody modelName(@javax.annotation.Nonnull String modelName) { + this.modelName = modelName; + return this; + } + + /** + * Get modelName + * @return modelName + */ + @javax.annotation.Nonnull + public String getModelName() { + return modelName; + } + + public void setModelName(@javax.annotation.Nonnull String modelName) { + this.modelName = modelName; + } + + + public FunctionSearchResultBody ownedBy(@javax.annotation.Nonnull String ownedBy) { + this.ownedBy = ownedBy; + return this; + } + + /** + * Get ownedBy + * @return ownedBy + */ + @javax.annotation.Nonnull + public String getOwnedBy() { + return ownedBy; + } + + public void setOwnedBy(@javax.annotation.Nonnull String ownedBy) { + this.ownedBy = ownedBy; + } + + /** + * 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 FunctionSearchResultBody instance itself + */ + public FunctionSearchResultBody 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; + } + FunctionSearchResultBody functionSearchResultBody = (FunctionSearchResultBody) o; + return Objects.equals(this.binaryName, functionSearchResultBody.binaryName) && + Objects.equals(this.createdAt, functionSearchResultBody.createdAt) && + Objects.equals(this.functionId, functionSearchResultBody.functionId) && + Objects.equals(this.functionName, functionSearchResultBody.functionName) && + Objects.equals(this.modelId, functionSearchResultBody.modelId) && + Objects.equals(this.modelName, functionSearchResultBody.modelName) && + Objects.equals(this.ownedBy, functionSearchResultBody.ownedBy)&& + Objects.equals(this.additionalProperties, functionSearchResultBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(binaryName, createdAt, functionId, functionName, modelId, modelName, ownedBy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionSearchResultBody {\n"); + sb.append(" binaryName: ").append(toIndentedString(binaryName)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); + sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); + sb.append(" modelName: ").append(toIndentedString(modelName)).append("\n"); + sb.append(" ownedBy: ").append(toIndentedString(ownedBy)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("binary_name", "created_at", "function_id", "function_name", "model_id", "model_name", "owned_by")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("binary_name", "created_at", "function_id", "function_name", "model_id", "model_name", "owned_by")); + } + + /** + * 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 FunctionSearchResultBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionSearchResultBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in FunctionSearchResultBody is not found in the empty JSON string", FunctionSearchResultBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionSearchResultBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("binary_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `binary_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("binary_name").toString())); + } + if (!jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + if (!jsonObj.get("model_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `model_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model_name").toString())); + } + if (!jsonObj.get("owned_by").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `owned_by` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owned_by").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionSearchResultBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionSearchResultBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FunctionSearchResultBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionSearchResultBody 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 FunctionSearchResultBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FunctionSearchResultBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FunctionSearchResultBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionSearchResultBody + * @throws IOException if the JSON string is invalid with respect to FunctionSearchResultBody + */ + public static FunctionSearchResultBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionSearchResultBody.class); + } + + /** + * Convert an instance of FunctionSearchResultBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GetBinaryExternalsOutputBody.java b/src/main/java/ai/reveng/model/GetBinaryExternalsOutputBody.java new file mode 100644 index 0000000..a9ab98a --- /dev/null +++ b/src/main/java/ai/reveng/model/GetBinaryExternalsOutputBody.java @@ -0,0 +1,313 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.BinaryExternalsBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * GetBinaryExternalsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetBinaryExternalsOutputBody { + public static final String SERIALIZED_NAME_BINARY_ID = "binary_id"; + @SerializedName(SERIALIZED_NAME_BINARY_ID) + @javax.annotation.Nonnull + private Long binaryId; + + public static final String SERIALIZED_NAME_EXTERNALS = "externals"; + @SerializedName(SERIALIZED_NAME_EXTERNALS) + @javax.annotation.Nonnull + private BinaryExternalsBody externals; + + public GetBinaryExternalsOutputBody() { + } + + public GetBinaryExternalsOutputBody binaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + return this; + } + + /** + * Get binaryId + * @return binaryId + */ + @javax.annotation.Nonnull + public Long getBinaryId() { + return binaryId; + } + + public void setBinaryId(@javax.annotation.Nonnull Long binaryId) { + this.binaryId = binaryId; + } + + + public GetBinaryExternalsOutputBody externals(@javax.annotation.Nonnull BinaryExternalsBody externals) { + this.externals = externals; + return this; + } + + /** + * Null until at least one external lookup has run for this binary's content hash + * @return externals + */ + @javax.annotation.Nonnull + public BinaryExternalsBody getExternals() { + return externals; + } + + public void setExternals(@javax.annotation.Nonnull BinaryExternalsBody externals) { + this.externals = externals; + } + + /** + * 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 GetBinaryExternalsOutputBody instance itself + */ + public GetBinaryExternalsOutputBody 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; + } + GetBinaryExternalsOutputBody getBinaryExternalsOutputBody = (GetBinaryExternalsOutputBody) o; + return Objects.equals(this.binaryId, getBinaryExternalsOutputBody.binaryId) && + Objects.equals(this.externals, getBinaryExternalsOutputBody.externals)&& + Objects.equals(this.additionalProperties, getBinaryExternalsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(binaryId, externals, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetBinaryExternalsOutputBody {\n"); + sb.append(" binaryId: ").append(toIndentedString(binaryId)).append("\n"); + sb.append(" externals: ").append(toIndentedString(externals)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("binary_id", "externals")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("binary_id", "externals")); + } + + /** + * 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 GetBinaryExternalsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetBinaryExternalsOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in GetBinaryExternalsOutputBody is not found in the empty JSON string", GetBinaryExternalsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetBinaryExternalsOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetBinaryExternalsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetBinaryExternalsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetBinaryExternalsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetBinaryExternalsOutputBody 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 GetBinaryExternalsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetBinaryExternalsOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetBinaryExternalsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetBinaryExternalsOutputBody + * @throws IOException if the JSON string is invalid with respect to GetBinaryExternalsOutputBody + */ + public static GetBinaryExternalsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetBinaryExternalsOutputBody.class); + } + + /** + * Convert an instance of GetBinaryExternalsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GetTokensResponse.java b/src/main/java/ai/reveng/model/GetTokensResponse.java index 6261e4e..584f63e 100644 --- a/src/main/java/ai/reveng/model/GetTokensResponse.java +++ b/src/main/java/ai/reveng/model/GetTokensResponse.java @@ -155,7 +155,7 @@ public GetTokensResponse putPlaceholderToUserOverrideItem(String key, Token plac } /** - * The caller's own overrides, keyed by token. Null until a run has succeeded. + * The overrides on this function, keyed by token, each carrying who chose it. Null until a run has succeeded. * @return placeholderToUserOverride */ @javax.annotation.Nonnull diff --git a/src/main/java/ai/reveng/model/NetworkingFinding.java b/src/main/java/ai/reveng/model/NetworkingFinding.java index 503105d..8b5ccee 100644 --- a/src/main/java/ai/reveng/model/NetworkingFinding.java +++ b/src/main/java/ai/reveng/model/NetworkingFinding.java @@ -15,6 +15,7 @@ import java.util.Objects; import ai.reveng.model.NetworkingCall; import ai.reveng.model.NetworkingDirectMatch; +import ai.reveng.model.NetworkingVerification; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -307,6 +308,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nullable private List sources; + public static final String SERIALIZED_NAME_VERIFICATION = "verification"; + @SerializedName(SERIALIZED_NAME_VERIFICATION) + @javax.annotation.Nullable + private NetworkingVerification verification; + public NetworkingFinding() { } @@ -550,6 +556,25 @@ public void setSources(@javax.annotation.Nullable List sources) { this.sources = sources; } + + public NetworkingFinding verification(@javax.annotation.Nullable NetworkingVerification verification) { + this.verification = verification; + return this; + } + + /** + * LLM verdict checking this finding against its decompilation. Present only when the run verified this finding. + * @return verification + */ + @javax.annotation.Nullable + public NetworkingVerification getVerification() { + return verification; + } + + public void setVerification(@javax.annotation.Nullable NetworkingVerification verification) { + this.verification = verification; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -615,7 +640,8 @@ public boolean equals(Object o) { Objects.equals(this.functionSize, networkingFinding.functionSize) && Objects.equals(this.networkCalls, networkingFinding.networkCalls) && Objects.equals(this.remote, networkingFinding.remote) && - Objects.equals(this.sources, networkingFinding.sources)&& + Objects.equals(this.sources, networkingFinding.sources) && + Objects.equals(this.verification, networkingFinding.verification)&& Objects.equals(this.additionalProperties, networkingFinding.additionalProperties); } @@ -625,7 +651,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(address, categories, confidence, directMatches, evidenceCount, functionId, functionName, functionSize, networkCalls, remote, sources, additionalProperties); + return Objects.hash(address, categories, confidence, directMatches, evidenceCount, functionId, functionName, functionSize, networkCalls, remote, sources, verification, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -650,6 +676,7 @@ public String toString() { sb.append(" networkCalls: ").append(toIndentedString(networkCalls)).append("\n"); sb.append(" remote: ").append(toIndentedString(remote)).append("\n"); sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" verification: ").append(toIndentedString(verification)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -669,7 +696,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "direct_matches", "evidence_count", "function_id", "function_name", "function_size", "network_calls", "remote", "sources")); + openapiFields = new HashSet(Arrays.asList("address", "categories", "confidence", "direct_matches", "evidence_count", "function_id", "function_name", "function_size", "network_calls", "remote", "sources", "verification")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("address", "categories", "confidence", "evidence_count", "function_id", "function_name", "function_size", "remote", "sources")); diff --git a/src/main/java/ai/reveng/model/NetworkingVerification.java b/src/main/java/ai/reveng/model/NetworkingVerification.java new file mode 100644 index 0000000..5318663 --- /dev/null +++ b/src/main/java/ai/reveng/model/NetworkingVerification.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 com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * NetworkingVerification + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class NetworkingVerification { + /** + * LLM's confidence in the verdict. Absent when verified is null. + */ + @JsonAdapter(ConfidenceEnum.Adapter.class) + public enum ConfidenceEnum { + HIGH("high"), + + MEDIUM("medium"), + + LOW("low"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ConfidenceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConfidenceEnum fromValue(String value) { + for (ConfidenceEnum b : ConfidenceEnum.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 ConfidenceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConfidenceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConfidenceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ConfidenceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_CONFIDENCE = "confidence"; + @SerializedName(SERIALIZED_NAME_CONFIDENCE) + @javax.annotation.Nullable + private ConfidenceEnum confidence; + + public static final String SERIALIZED_NAME_REASONING = "reasoning"; + @SerializedName(SERIALIZED_NAME_REASONING) + @javax.annotation.Nonnull + private String reasoning; + + public static final String SERIALIZED_NAME_VERIFIED = "verified"; + @SerializedName(SERIALIZED_NAME_VERIFIED) + @javax.annotation.Nullable + private Boolean verified; + + public NetworkingVerification() { + } + + public NetworkingVerification confidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + return this; + } + + /** + * LLM's confidence in the verdict. Absent when verified is null. + * @return confidence + */ + @javax.annotation.Nullable + public ConfidenceEnum getConfidence() { + return confidence; + } + + public void setConfidence(@javax.annotation.Nullable ConfidenceEnum confidence) { + this.confidence = confidence; + } + + + public NetworkingVerification reasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + return this; + } + + /** + * LLM's explanation for the verdict, or the reason verification could not be completed + * @return reasoning + */ + @javax.annotation.Nonnull + public String getReasoning() { + return reasoning; + } + + public void setReasoning(@javax.annotation.Nonnull String reasoning) { + this.reasoning = reasoning; + } + + + public NetworkingVerification verified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + return this; + } + + /** + * Whether an LLM confirmed the finding against its decompilation; null if verification could not be completed, in which case the finding is kept unverified rather than dropped + * @return verified + */ + @javax.annotation.Nullable + public Boolean getVerified() { + return verified; + } + + public void setVerified(@javax.annotation.Nullable Boolean verified) { + this.verified = verified; + } + + /** + * 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 NetworkingVerification instance itself + */ + public NetworkingVerification 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; + } + NetworkingVerification networkingVerification = (NetworkingVerification) o; + return Objects.equals(this.confidence, networkingVerification.confidence) && + Objects.equals(this.reasoning, networkingVerification.reasoning) && + Objects.equals(this.verified, networkingVerification.verified)&& + Objects.equals(this.additionalProperties, networkingVerification.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(confidence, reasoning, verified, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NetworkingVerification {\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" reasoning: ").append(toIndentedString(reasoning)).append("\n"); + sb.append(" verified: ").append(toIndentedString(verified)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("confidence", "reasoning", "verified")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("reasoning", "verified")); + } + + /** + * 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 NetworkingVerification + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NetworkingVerification.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in NetworkingVerification is not found in the empty JSON string", NetworkingVerification.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NetworkingVerification.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) && !jsonObj.get("confidence").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `confidence` to be a primitive type in the JSON string but got `%s`", jsonObj.get("confidence").toString())); + } + // validate the optional field `confidence` + if (jsonObj.get("confidence") != null && !jsonObj.get("confidence").isJsonNull()) { + ConfidenceEnum.validateJsonElement(jsonObj.get("confidence")); + } + if (!jsonObj.get("reasoning").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reasoning` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reasoning").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NetworkingVerification.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NetworkingVerification' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NetworkingVerification.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NetworkingVerification 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 NetworkingVerification read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + NetworkingVerification instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of NetworkingVerification given an JSON string + * + * @param jsonString JSON string + * @return An instance of NetworkingVerification + * @throws IOException if the JSON string is invalid with respect to NetworkingVerification + */ + public static NetworkingVerification fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NetworkingVerification.class); + } + + /** + * Convert an instance of NetworkingVerification to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ReportAnalysisBody.java b/src/main/java/ai/reveng/model/ReportAnalysisBody.java new file mode 100644 index 0000000..4a68537 --- /dev/null +++ b/src/main/java/ai/reveng/model/ReportAnalysisBody.java @@ -0,0 +1,313 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.SoftwareTypeCountsBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * ReportAnalysisBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ReportAnalysisBody { + public static final String SERIALIZED_NAME_COMPLETED = "completed"; + @SerializedName(SERIALIZED_NAME_COMPLETED) + @javax.annotation.Nonnull + private Long completed; + + public static final String SERIALIZED_NAME_SOFTWARE_TYPES = "software_types"; + @SerializedName(SERIALIZED_NAME_SOFTWARE_TYPES) + @javax.annotation.Nonnull + private SoftwareTypeCountsBody softwareTypes; + + public ReportAnalysisBody() { + } + + public ReportAnalysisBody completed(@javax.annotation.Nonnull Long completed) { + this.completed = completed; + return this; + } + + /** + * REPORT_ANALYSIS agent tasks completed that day + * @return completed + */ + @javax.annotation.Nonnull + public Long getCompleted() { + return completed; + } + + public void setCompleted(@javax.annotation.Nonnull Long completed) { + this.completed = completed; + } + + + public ReportAnalysisBody softwareTypes(@javax.annotation.Nonnull SoftwareTypeCountsBody softwareTypes) { + this.softwareTypes = softwareTypes; + return this; + } + + /** + * Breakdown of completed reports by the software type the agent classified + * @return softwareTypes + */ + @javax.annotation.Nonnull + public SoftwareTypeCountsBody getSoftwareTypes() { + return softwareTypes; + } + + public void setSoftwareTypes(@javax.annotation.Nonnull SoftwareTypeCountsBody softwareTypes) { + this.softwareTypes = softwareTypes; + } + + /** + * 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 ReportAnalysisBody instance itself + */ + public ReportAnalysisBody 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; + } + ReportAnalysisBody reportAnalysisBody = (ReportAnalysisBody) o; + return Objects.equals(this.completed, reportAnalysisBody.completed) && + Objects.equals(this.softwareTypes, reportAnalysisBody.softwareTypes)&& + Objects.equals(this.additionalProperties, reportAnalysisBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(completed, softwareTypes, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportAnalysisBody {\n"); + sb.append(" completed: ").append(toIndentedString(completed)).append("\n"); + sb.append(" softwareTypes: ").append(toIndentedString(softwareTypes)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("completed", "software_types")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("completed", "software_types")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReportAnalysisBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReportAnalysisBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReportAnalysisBody is not found in the empty JSON string", ReportAnalysisBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReportAnalysisBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReportAnalysisBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReportAnalysisBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReportAnalysisBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReportAnalysisBody 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 ReportAnalysisBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReportAnalysisBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ReportAnalysisBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReportAnalysisBody + * @throws IOException if the JSON string is invalid with respect to ReportAnalysisBody + */ + public static ReportAnalysisBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReportAnalysisBody.class); + } + + /** + * Convert an instance of ReportAnalysisBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SearchBinariesOutputBody.java b/src/main/java/ai/reveng/model/SearchBinariesOutputBody.java new file mode 100644 index 0000000..3d090c1 --- /dev/null +++ b/src/main/java/ai/reveng/model/SearchBinariesOutputBody.java @@ -0,0 +1,381 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.BinarySearchResultBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * SearchBinariesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SearchBinariesOutputBody { + public static final String SERIALIZED_NAME_HAS_NEXT_PAGE = "has_next_page"; + @SerializedName(SERIALIZED_NAME_HAS_NEXT_PAGE) + @javax.annotation.Nonnull + private Boolean hasNextPage; + + public static final String SERIALIZED_NAME_PAGE_NUMBER = "page_number"; + @SerializedName(SERIALIZED_NAME_PAGE_NUMBER) + @javax.annotation.Nonnull + private Long pageNumber; + + public static final String SERIALIZED_NAME_PAGE_SIZE = "page_size"; + @SerializedName(SERIALIZED_NAME_PAGE_SIZE) + @javax.annotation.Nonnull + private Long pageSize; + + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) + @javax.annotation.Nullable + private List results; + + public SearchBinariesOutputBody() { + } + + public SearchBinariesOutputBody hasNextPage(@javax.annotation.Nonnull Boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + /** + * Get hasNextPage + * @return hasNextPage + */ + @javax.annotation.Nonnull + public Boolean getHasNextPage() { + return hasNextPage; + } + + public void setHasNextPage(@javax.annotation.Nonnull Boolean hasNextPage) { + this.hasNextPage = hasNextPage; + } + + + public SearchBinariesOutputBody pageNumber(@javax.annotation.Nonnull Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Get pageNumber + * @return pageNumber + */ + @javax.annotation.Nonnull + public Long getPageNumber() { + return pageNumber; + } + + public void setPageNumber(@javax.annotation.Nonnull Long pageNumber) { + this.pageNumber = pageNumber; + } + + + public SearchBinariesOutputBody pageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get pageSize + * @return pageSize + */ + @javax.annotation.Nonnull + public Long getPageSize() { + return pageSize; + } + + public void setPageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + } + + + public SearchBinariesOutputBody results(@javax.annotation.Nullable List results) { + this.results = results; + return this; + } + + public SearchBinariesOutputBody addResultsItem(BinarySearchResultBody resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * @return results + */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + public void setResults(@javax.annotation.Nullable List results) { + this.results = results; + } + + /** + * 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 SearchBinariesOutputBody instance itself + */ + public SearchBinariesOutputBody 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; + } + SearchBinariesOutputBody searchBinariesOutputBody = (SearchBinariesOutputBody) o; + return Objects.equals(this.hasNextPage, searchBinariesOutputBody.hasNextPage) && + Objects.equals(this.pageNumber, searchBinariesOutputBody.pageNumber) && + Objects.equals(this.pageSize, searchBinariesOutputBody.pageSize) && + Objects.equals(this.results, searchBinariesOutputBody.results)&& + Objects.equals(this.additionalProperties, searchBinariesOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(hasNextPage, pageNumber, pageSize, results, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchBinariesOutputBody {\n"); + sb.append(" hasNextPage: ").append(toIndentedString(hasNextPage)).append("\n"); + sb.append(" pageNumber: ").append(toIndentedString(pageNumber)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("has_next_page", "page_number", "page_size", "results")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("has_next_page", "page_number", "page_size", "results")); + } + + /** + * 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 SearchBinariesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchBinariesOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SearchBinariesOutputBody is not found in the empty JSON string", SearchBinariesOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchBinariesOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("results") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("results").isJsonArray() && !jsonObj.get("results").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchBinariesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchBinariesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchBinariesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchBinariesOutputBody 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 SearchBinariesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchBinariesOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchBinariesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchBinariesOutputBody + * @throws IOException if the JSON string is invalid with respect to SearchBinariesOutputBody + */ + public static SearchBinariesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchBinariesOutputBody.class); + } + + /** + * Convert an instance of SearchBinariesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SearchFunctionsOutputBody.java b/src/main/java/ai/reveng/model/SearchFunctionsOutputBody.java new file mode 100644 index 0000000..03a75c7 --- /dev/null +++ b/src/main/java/ai/reveng/model/SearchFunctionsOutputBody.java @@ -0,0 +1,381 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.FunctionSearchResultBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * SearchFunctionsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SearchFunctionsOutputBody { + public static final String SERIALIZED_NAME_HAS_NEXT_PAGE = "has_next_page"; + @SerializedName(SERIALIZED_NAME_HAS_NEXT_PAGE) + @javax.annotation.Nonnull + private Boolean hasNextPage; + + public static final String SERIALIZED_NAME_PAGE_NUMBER = "page_number"; + @SerializedName(SERIALIZED_NAME_PAGE_NUMBER) + @javax.annotation.Nonnull + private Long pageNumber; + + public static final String SERIALIZED_NAME_PAGE_SIZE = "page_size"; + @SerializedName(SERIALIZED_NAME_PAGE_SIZE) + @javax.annotation.Nonnull + private Long pageSize; + + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) + @javax.annotation.Nullable + private List results; + + public SearchFunctionsOutputBody() { + } + + public SearchFunctionsOutputBody hasNextPage(@javax.annotation.Nonnull Boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + /** + * Get hasNextPage + * @return hasNextPage + */ + @javax.annotation.Nonnull + public Boolean getHasNextPage() { + return hasNextPage; + } + + public void setHasNextPage(@javax.annotation.Nonnull Boolean hasNextPage) { + this.hasNextPage = hasNextPage; + } + + + public SearchFunctionsOutputBody pageNumber(@javax.annotation.Nonnull Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Get pageNumber + * @return pageNumber + */ + @javax.annotation.Nonnull + public Long getPageNumber() { + return pageNumber; + } + + public void setPageNumber(@javax.annotation.Nonnull Long pageNumber) { + this.pageNumber = pageNumber; + } + + + public SearchFunctionsOutputBody pageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get pageSize + * @return pageSize + */ + @javax.annotation.Nonnull + public Long getPageSize() { + return pageSize; + } + + public void setPageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + } + + + public SearchFunctionsOutputBody results(@javax.annotation.Nullable List results) { + this.results = results; + return this; + } + + public SearchFunctionsOutputBody addResultsItem(FunctionSearchResultBody resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * @return results + */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + public void setResults(@javax.annotation.Nullable List results) { + this.results = results; + } + + /** + * 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 SearchFunctionsOutputBody instance itself + */ + public SearchFunctionsOutputBody 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; + } + SearchFunctionsOutputBody searchFunctionsOutputBody = (SearchFunctionsOutputBody) o; + return Objects.equals(this.hasNextPage, searchFunctionsOutputBody.hasNextPage) && + Objects.equals(this.pageNumber, searchFunctionsOutputBody.pageNumber) && + Objects.equals(this.pageSize, searchFunctionsOutputBody.pageSize) && + Objects.equals(this.results, searchFunctionsOutputBody.results)&& + Objects.equals(this.additionalProperties, searchFunctionsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(hasNextPage, pageNumber, pageSize, results, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchFunctionsOutputBody {\n"); + sb.append(" hasNextPage: ").append(toIndentedString(hasNextPage)).append("\n"); + sb.append(" pageNumber: ").append(toIndentedString(pageNumber)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("has_next_page", "page_number", "page_size", "results")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("has_next_page", "page_number", "page_size", "results")); + } + + /** + * 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 SearchFunctionsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchFunctionsOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SearchFunctionsOutputBody is not found in the empty JSON string", SearchFunctionsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchFunctionsOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("results") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("results").isJsonArray() && !jsonObj.get("results").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchFunctionsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchFunctionsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchFunctionsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchFunctionsOutputBody 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 SearchFunctionsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchFunctionsOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchFunctionsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchFunctionsOutputBody + * @throws IOException if the JSON string is invalid with respect to SearchFunctionsOutputBody + */ + public static SearchFunctionsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchFunctionsOutputBody.class); + } + + /** + * Convert an instance of SearchFunctionsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SearchTagsOutputBody.java b/src/main/java/ai/reveng/model/SearchTagsOutputBody.java new file mode 100644 index 0000000..fd211d8 --- /dev/null +++ b/src/main/java/ai/reveng/model/SearchTagsOutputBody.java @@ -0,0 +1,381 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.TagSearchResultBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * SearchTagsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SearchTagsOutputBody { + public static final String SERIALIZED_NAME_HAS_NEXT_PAGE = "has_next_page"; + @SerializedName(SERIALIZED_NAME_HAS_NEXT_PAGE) + @javax.annotation.Nonnull + private Boolean hasNextPage; + + public static final String SERIALIZED_NAME_PAGE_NUMBER = "page_number"; + @SerializedName(SERIALIZED_NAME_PAGE_NUMBER) + @javax.annotation.Nonnull + private Long pageNumber; + + public static final String SERIALIZED_NAME_PAGE_SIZE = "page_size"; + @SerializedName(SERIALIZED_NAME_PAGE_SIZE) + @javax.annotation.Nonnull + private Long pageSize; + + public static final String SERIALIZED_NAME_RESULTS = "results"; + @SerializedName(SERIALIZED_NAME_RESULTS) + @javax.annotation.Nullable + private List results; + + public SearchTagsOutputBody() { + } + + public SearchTagsOutputBody hasNextPage(@javax.annotation.Nonnull Boolean hasNextPage) { + this.hasNextPage = hasNextPage; + return this; + } + + /** + * Get hasNextPage + * @return hasNextPage + */ + @javax.annotation.Nonnull + public Boolean getHasNextPage() { + return hasNextPage; + } + + public void setHasNextPage(@javax.annotation.Nonnull Boolean hasNextPage) { + this.hasNextPage = hasNextPage; + } + + + public SearchTagsOutputBody pageNumber(@javax.annotation.Nonnull Long pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Get pageNumber + * @return pageNumber + */ + @javax.annotation.Nonnull + public Long getPageNumber() { + return pageNumber; + } + + public void setPageNumber(@javax.annotation.Nonnull Long pageNumber) { + this.pageNumber = pageNumber; + } + + + public SearchTagsOutputBody pageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Get pageSize + * @return pageSize + */ + @javax.annotation.Nonnull + public Long getPageSize() { + return pageSize; + } + + public void setPageSize(@javax.annotation.Nonnull Long pageSize) { + this.pageSize = pageSize; + } + + + public SearchTagsOutputBody results(@javax.annotation.Nullable List results) { + this.results = results; + return this; + } + + public SearchTagsOutputBody addResultsItem(TagSearchResultBody resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * @return results + */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + public void setResults(@javax.annotation.Nullable List results) { + this.results = results; + } + + /** + * 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 SearchTagsOutputBody instance itself + */ + public SearchTagsOutputBody 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; + } + SearchTagsOutputBody searchTagsOutputBody = (SearchTagsOutputBody) o; + return Objects.equals(this.hasNextPage, searchTagsOutputBody.hasNextPage) && + Objects.equals(this.pageNumber, searchTagsOutputBody.pageNumber) && + Objects.equals(this.pageSize, searchTagsOutputBody.pageSize) && + Objects.equals(this.results, searchTagsOutputBody.results)&& + Objects.equals(this.additionalProperties, searchTagsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(hasNextPage, pageNumber, pageSize, results, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchTagsOutputBody {\n"); + sb.append(" hasNextPage: ").append(toIndentedString(hasNextPage)).append("\n"); + sb.append(" pageNumber: ").append(toIndentedString(pageNumber)).append("\n"); + sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("has_next_page", "page_number", "page_size", "results")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("has_next_page", "page_number", "page_size", "results")); + } + + /** + * 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 SearchTagsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchTagsOutputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SearchTagsOutputBody is not found in the empty JSON string", SearchTagsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchTagsOutputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("results") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("results").isJsonArray() && !jsonObj.get("results").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchTagsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchTagsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchTagsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchTagsOutputBody 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 SearchTagsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchTagsOutputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchTagsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchTagsOutputBody + * @throws IOException if the JSON string is invalid with respect to SearchTagsOutputBody + */ + public static SearchTagsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchTagsOutputBody.class); + } + + /** + * Convert an instance of SearchTagsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SoftwareTypeCountsBody.java b/src/main/java/ai/reveng/model/SoftwareTypeCountsBody.java new file mode 100644 index 0000000..dfceb95 --- /dev/null +++ b/src/main/java/ai/reveng/model/SoftwareTypeCountsBody.java @@ -0,0 +1,390 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * SoftwareTypeCountsBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SoftwareTypeCountsBody { + public static final String SERIALIZED_NAME_BENIGN = "benign"; + @SerializedName(SERIALIZED_NAME_BENIGN) + @javax.annotation.Nonnull + private Long benign; + + public static final String SERIALIZED_NAME_LEGITIMATE = "legitimate"; + @SerializedName(SERIALIZED_NAME_LEGITIMATE) + @javax.annotation.Nonnull + private Long legitimate; + + public static final String SERIALIZED_NAME_LEGITIMATE_SOFTWARE_BACKDOOR = "legitimate_software_backdoor"; + @SerializedName(SERIALIZED_NAME_LEGITIMATE_SOFTWARE_BACKDOOR) + @javax.annotation.Nonnull + private Long legitimateSoftwareBackdoor; + + public static final String SERIALIZED_NAME_MALICIOUS = "malicious"; + @SerializedName(SERIALIZED_NAME_MALICIOUS) + @javax.annotation.Nonnull + private Long malicious; + + public static final String SERIALIZED_NAME_POTENTIALLY_UNWANTED_APPLICATION = "potentially_unwanted_application"; + @SerializedName(SERIALIZED_NAME_POTENTIALLY_UNWANTED_APPLICATION) + @javax.annotation.Nonnull + private Long potentiallyUnwantedApplication; + + public SoftwareTypeCountsBody() { + } + + public SoftwareTypeCountsBody benign(@javax.annotation.Nonnull Long benign) { + this.benign = benign; + return this; + } + + /** + * Reports classifying the software as benign + * @return benign + */ + @javax.annotation.Nonnull + public Long getBenign() { + return benign; + } + + public void setBenign(@javax.annotation.Nonnull Long benign) { + this.benign = benign; + } + + + public SoftwareTypeCountsBody legitimate(@javax.annotation.Nonnull Long legitimate) { + this.legitimate = legitimate; + return this; + } + + /** + * Reports classifying the software as legitimate + * @return legitimate + */ + @javax.annotation.Nonnull + public Long getLegitimate() { + return legitimate; + } + + public void setLegitimate(@javax.annotation.Nonnull Long legitimate) { + this.legitimate = legitimate; + } + + + public SoftwareTypeCountsBody legitimateSoftwareBackdoor(@javax.annotation.Nonnull Long legitimateSoftwareBackdoor) { + this.legitimateSoftwareBackdoor = legitimateSoftwareBackdoor; + return this; + } + + /** + * Reports classifying the software as a legitimate backdoor + * @return legitimateSoftwareBackdoor + */ + @javax.annotation.Nonnull + public Long getLegitimateSoftwareBackdoor() { + return legitimateSoftwareBackdoor; + } + + public void setLegitimateSoftwareBackdoor(@javax.annotation.Nonnull Long legitimateSoftwareBackdoor) { + this.legitimateSoftwareBackdoor = legitimateSoftwareBackdoor; + } + + + public SoftwareTypeCountsBody malicious(@javax.annotation.Nonnull Long malicious) { + this.malicious = malicious; + return this; + } + + /** + * Reports classifying the software as malicious + * @return malicious + */ + @javax.annotation.Nonnull + public Long getMalicious() { + return malicious; + } + + public void setMalicious(@javax.annotation.Nonnull Long malicious) { + this.malicious = malicious; + } + + + public SoftwareTypeCountsBody potentiallyUnwantedApplication(@javax.annotation.Nonnull Long potentiallyUnwantedApplication) { + this.potentiallyUnwantedApplication = potentiallyUnwantedApplication; + return this; + } + + /** + * Reports classifying the software as a potentially unwanted application + * @return potentiallyUnwantedApplication + */ + @javax.annotation.Nonnull + public Long getPotentiallyUnwantedApplication() { + return potentiallyUnwantedApplication; + } + + public void setPotentiallyUnwantedApplication(@javax.annotation.Nonnull Long potentiallyUnwantedApplication) { + this.potentiallyUnwantedApplication = potentiallyUnwantedApplication; + } + + /** + * 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 SoftwareTypeCountsBody instance itself + */ + public SoftwareTypeCountsBody 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; + } + SoftwareTypeCountsBody softwareTypeCountsBody = (SoftwareTypeCountsBody) o; + return Objects.equals(this.benign, softwareTypeCountsBody.benign) && + Objects.equals(this.legitimate, softwareTypeCountsBody.legitimate) && + Objects.equals(this.legitimateSoftwareBackdoor, softwareTypeCountsBody.legitimateSoftwareBackdoor) && + Objects.equals(this.malicious, softwareTypeCountsBody.malicious) && + Objects.equals(this.potentiallyUnwantedApplication, softwareTypeCountsBody.potentiallyUnwantedApplication)&& + Objects.equals(this.additionalProperties, softwareTypeCountsBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(benign, legitimate, legitimateSoftwareBackdoor, malicious, potentiallyUnwantedApplication, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SoftwareTypeCountsBody {\n"); + sb.append(" benign: ").append(toIndentedString(benign)).append("\n"); + sb.append(" legitimate: ").append(toIndentedString(legitimate)).append("\n"); + sb.append(" legitimateSoftwareBackdoor: ").append(toIndentedString(legitimateSoftwareBackdoor)).append("\n"); + sb.append(" malicious: ").append(toIndentedString(malicious)).append("\n"); + sb.append(" potentiallyUnwantedApplication: ").append(toIndentedString(potentiallyUnwantedApplication)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("benign", "legitimate", "legitimate_software_backdoor", "malicious", "potentially_unwanted_application")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("benign", "legitimate", "legitimate_software_backdoor", "malicious", "potentially_unwanted_application")); + } + + /** + * 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 SoftwareTypeCountsBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SoftwareTypeCountsBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in SoftwareTypeCountsBody is not found in the empty JSON string", SoftwareTypeCountsBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SoftwareTypeCountsBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SoftwareTypeCountsBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SoftwareTypeCountsBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SoftwareTypeCountsBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SoftwareTypeCountsBody 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 SoftwareTypeCountsBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SoftwareTypeCountsBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SoftwareTypeCountsBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SoftwareTypeCountsBody + * @throws IOException if the JSON string is invalid with respect to SoftwareTypeCountsBody + */ + public static SoftwareTypeCountsBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SoftwareTypeCountsBody.class); + } + + /** + * Convert an instance of SoftwareTypeCountsBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TagSearchResultBody.java b/src/main/java/ai/reveng/model/TagSearchResultBody.java new file mode 100644 index 0000000..18a8c3d --- /dev/null +++ b/src/main/java/ai/reveng/model/TagSearchResultBody.java @@ -0,0 +1,315 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * TagSearchResultBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TagSearchResultBody { + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + @javax.annotation.Nonnull + private String tag; + + public static final String SERIALIZED_NAME_TAG_ID = "tag_id"; + @SerializedName(SERIALIZED_NAME_TAG_ID) + @javax.annotation.Nonnull + private Long tagId; + + public TagSearchResultBody() { + } + + public TagSearchResultBody tag(@javax.annotation.Nonnull String tag) { + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + */ + @javax.annotation.Nonnull + public String getTag() { + return tag; + } + + public void setTag(@javax.annotation.Nonnull String tag) { + this.tag = tag; + } + + + public TagSearchResultBody tagId(@javax.annotation.Nonnull Long tagId) { + this.tagId = tagId; + return this; + } + + /** + * Get tagId + * @return tagId + */ + @javax.annotation.Nonnull + public Long getTagId() { + return tagId; + } + + public void setTagId(@javax.annotation.Nonnull Long tagId) { + this.tagId = tagId; + } + + /** + * 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 TagSearchResultBody instance itself + */ + public TagSearchResultBody 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; + } + TagSearchResultBody tagSearchResultBody = (TagSearchResultBody) o; + return Objects.equals(this.tag, tagSearchResultBody.tag) && + Objects.equals(this.tagId, tagSearchResultBody.tagId)&& + Objects.equals(this.additionalProperties, tagSearchResultBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tag, tagId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagSearchResultBody {\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" tagId: ").append(toIndentedString(tagId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("tag", "tag_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("tag", "tag_id")); + } + + /** + * 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 TagSearchResultBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagSearchResultBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in TagSearchResultBody is not found in the empty JSON string", TagSearchResultBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagSearchResultBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagSearchResultBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagSearchResultBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagSearchResultBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagSearchResultBody 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 TagSearchResultBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TagSearchResultBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TagSearchResultBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagSearchResultBody + * @throws IOException if the JSON string is invalid with respect to TagSearchResultBody + */ + public static TagSearchResultBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagSearchResultBody.class); + } + + /** + * Convert an instance of TagSearchResultBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Token.java b/src/main/java/ai/reveng/model/Token.java index df39744..8cbc07a 100644 --- a/src/main/java/ai/reveng/model/Token.java +++ b/src/main/java/ai/reveng/model/Token.java @@ -49,6 +49,65 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Token { + /** + * Who chose this override. Response only; ignored in a request. + */ + @JsonAdapter(SourceEnum.Adapter.class) + public enum SourceEnum { + USER("user"), + + LLM("llm"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceEnum fromValue(String value) { + for (SourceEnum b : SourceEnum.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 SourceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nullable + private SourceEnum source; + public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) @javax.annotation.Nonnull @@ -57,6 +116,25 @@ public class Token { public Token() { } + public Token source(@javax.annotation.Nullable SourceEnum source) { + this.source = source; + return this; + } + + /** + * Who chose this override. Response only; ignored in a request. + * @return source + */ + @javax.annotation.Nullable + public SourceEnum getSource() { + return source; + } + + public void setSource(@javax.annotation.Nullable SourceEnum source) { + this.source = source; + } + + public Token value(@javax.annotation.Nonnull String value) { this.value = value; return this; @@ -130,19 +208,21 @@ public boolean equals(Object o) { return false; } Token token = (Token) o; - return Objects.equals(this.value, token.value)&& + return Objects.equals(this.source, token.source) && + Objects.equals(this.value, token.value)&& Objects.equals(this.additionalProperties, token.additionalProperties); } @Override public int hashCode() { - return Objects.hash(value, additionalProperties); + return Objects.hash(source, value, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Token {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); @@ -163,7 +243,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("value")); + openapiFields = new HashSet(Arrays.asList("source", "value")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("value")); @@ -189,6 +269,13 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) && !jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + // validate the optional field `source` + if (jsonObj.get("source") != null && !jsonObj.get("source").isJsonNull()) { + SourceEnum.validateJsonElement(jsonObj.get("source")); + } if (!jsonObj.get("value").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); } diff --git a/src/main/java/ai/reveng/model/UpdateTagsInputBody.java b/src/main/java/ai/reveng/model/UpdateTagsInputBody.java new file mode 100644 index 0000000..198dd2c --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateTagsInputBody.java @@ -0,0 +1,302 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * UpdateTagsInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateTagsInputBody { + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public UpdateTagsInputBody() { + } + + public UpdateTagsInputBody tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public UpdateTagsInputBody addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The complete set of user tags the analysis' binary should carry after this call + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateTagsInputBody instance itself + */ + public UpdateTagsInputBody 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; + } + UpdateTagsInputBody updateTagsInputBody = (UpdateTagsInputBody) o; + return Objects.equals(this.tags, updateTagsInputBody.tags)&& + Objects.equals(this.additionalProperties, updateTagsInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTagsInputBody {\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("tags")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("tags")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTagsInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTagsInputBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in UpdateTagsInputBody is not found in the empty JSON string", UpdateTagsInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTagsInputBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("tags") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("tags").isJsonArray() && !jsonObj.get("tags").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTagsInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTagsInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateTagsInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTagsInputBody 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 UpdateTagsInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateTagsInputBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTagsInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTagsInputBody + * @throws IOException if the JSON string is invalid with respect to UpdateTagsInputBody + */ + public static UpdateTagsInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTagsInputBody.class); + } + + /** + * Convert an instance of UpdateTagsInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpsertOverridesData.java b/src/main/java/ai/reveng/model/UpsertOverridesData.java index 712fc25..e28d666 100644 --- a/src/main/java/ai/reveng/model/UpsertOverridesData.java +++ b/src/main/java/ai/reveng/model/UpsertOverridesData.java @@ -74,7 +74,7 @@ public UpsertOverridesData putPlaceholderToUserOverrideItem(String key, Token pl } /** - * Every override on the function after applying this request, keyed by placeholder token. + * Every override on the function after applying this request, keyed by placeholder token, each carrying who chose it. * @return placeholderToUserOverride */ @javax.annotation.Nonnull diff --git a/src/main/java/ai/reveng/model/WorkflowDayBody.java b/src/main/java/ai/reveng/model/WorkflowDayBody.java new file mode 100644 index 0000000..067f891 --- /dev/null +++ b/src/main/java/ai/reveng/model/WorkflowDayBody.java @@ -0,0 +1,343 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.AnalyseCapabilitiesBody; +import ai.reveng.model.ReportAnalysisBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * WorkflowDayBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class WorkflowDayBody { + public static final String SERIALIZED_NAME_ANALYSE_CAPABILITIES = "analyse_capabilities"; + @SerializedName(SERIALIZED_NAME_ANALYSE_CAPABILITIES) + @javax.annotation.Nonnull + private AnalyseCapabilitiesBody analyseCapabilities; + + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + @javax.annotation.Nonnull + private String date; + + public static final String SERIALIZED_NAME_REPORT_ANALYSIS = "report_analysis"; + @SerializedName(SERIALIZED_NAME_REPORT_ANALYSIS) + @javax.annotation.Nonnull + private ReportAnalysisBody reportAnalysis; + + public WorkflowDayBody() { + } + + public WorkflowDayBody analyseCapabilities(@javax.annotation.Nonnull AnalyseCapabilitiesBody analyseCapabilities) { + this.analyseCapabilities = analyseCapabilities; + return this; + } + + /** + * ANALYSE_CAPABILITIES agent-task stats for the day + * @return analyseCapabilities + */ + @javax.annotation.Nonnull + public AnalyseCapabilitiesBody getAnalyseCapabilities() { + return analyseCapabilities; + } + + public void setAnalyseCapabilities(@javax.annotation.Nonnull AnalyseCapabilitiesBody analyseCapabilities) { + this.analyseCapabilities = analyseCapabilities; + } + + + public WorkflowDayBody date(@javax.annotation.Nonnull String date) { + this.date = date; + return this; + } + + /** + * Day this entry covers + * @return date + */ + @javax.annotation.Nonnull + public String getDate() { + return date; + } + + public void setDate(@javax.annotation.Nonnull String date) { + this.date = date; + } + + + public WorkflowDayBody reportAnalysis(@javax.annotation.Nonnull ReportAnalysisBody reportAnalysis) { + this.reportAnalysis = reportAnalysis; + return this; + } + + /** + * REPORT_ANALYSIS agent-task stats for the day + * @return reportAnalysis + */ + @javax.annotation.Nonnull + public ReportAnalysisBody getReportAnalysis() { + return reportAnalysis; + } + + public void setReportAnalysis(@javax.annotation.Nonnull ReportAnalysisBody reportAnalysis) { + this.reportAnalysis = reportAnalysis; + } + + /** + * 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 WorkflowDayBody instance itself + */ + public WorkflowDayBody 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; + } + WorkflowDayBody workflowDayBody = (WorkflowDayBody) o; + return Objects.equals(this.analyseCapabilities, workflowDayBody.analyseCapabilities) && + Objects.equals(this.date, workflowDayBody.date) && + Objects.equals(this.reportAnalysis, workflowDayBody.reportAnalysis)&& + Objects.equals(this.additionalProperties, workflowDayBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(analyseCapabilities, date, reportAnalysis, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowDayBody {\n"); + sb.append(" analyseCapabilities: ").append(toIndentedString(analyseCapabilities)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" reportAnalysis: ").append(toIndentedString(reportAnalysis)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analyse_capabilities", "date", "report_analysis")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analyse_capabilities", "date", "report_analysis")); + } + + /** + * 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 WorkflowDayBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WorkflowDayBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in WorkflowDayBody is not found in the empty JSON string", WorkflowDayBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WorkflowDayBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("date").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("date").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WorkflowDayBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WorkflowDayBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WorkflowDayBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WorkflowDayBody 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 WorkflowDayBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WorkflowDayBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WorkflowDayBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of WorkflowDayBody + * @throws IOException if the JSON string is invalid with respect to WorkflowDayBody + */ + public static WorkflowDayBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WorkflowDayBody.class); + } + + /** + * Convert an instance of WorkflowDayBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/XrefFromBody.java b/src/main/java/ai/reveng/model/XrefFromBody.java new file mode 100644 index 0000000..290caa4 --- /dev/null +++ b/src/main/java/ai/reveng/model/XrefFromBody.java @@ -0,0 +1,504 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.XrefSegmentBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * XrefFromBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class XrefFromBody { + public static final String SERIALIZED_NAME_IS_CALL = "is_call"; + @SerializedName(SERIALIZED_NAME_IS_CALL) + @javax.annotation.Nonnull + private Boolean isCall; + + public static final String SERIALIZED_NAME_IS_DATA = "is_data"; + @SerializedName(SERIALIZED_NAME_IS_DATA) + @javax.annotation.Nonnull + private Boolean isData; + + public static final String SERIALIZED_NAME_IS_SCALAR = "is_scalar"; + @SerializedName(SERIALIZED_NAME_IS_SCALAR) + @javax.annotation.Nonnull + private Boolean isScalar; + + public static final String SERIALIZED_NAME_IS_STRING = "is_string"; + @SerializedName(SERIALIZED_NAME_IS_STRING) + @javax.annotation.Nonnull + private Boolean isString; + + public static final String SERIALIZED_NAME_ORIG_STR_ENCODING = "orig_str_encoding"; + @SerializedName(SERIALIZED_NAME_ORIG_STR_ENCODING) + @javax.annotation.Nullable + private String origStrEncoding; + + public static final String SERIALIZED_NAME_RAW_DATA = "raw_data"; + @SerializedName(SERIALIZED_NAME_RAW_DATA) + @javax.annotation.Nullable + private String rawData; + + public static final String SERIALIZED_NAME_SEGMENT = "segment"; + @SerializedName(SERIALIZED_NAME_SEGMENT) + @javax.annotation.Nullable + private XrefSegmentBody segment; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_XREF_TO = "xref_to"; + @SerializedName(SERIALIZED_NAME_XREF_TO) + @javax.annotation.Nonnull + private Long xrefTo; + + public XrefFromBody() { + } + + public XrefFromBody isCall(@javax.annotation.Nonnull Boolean isCall) { + this.isCall = isCall; + return this; + } + + /** + * True when the xref is a call instruction + * @return isCall + */ + @javax.annotation.Nonnull + public Boolean getIsCall() { + return isCall; + } + + public void setIsCall(@javax.annotation.Nonnull Boolean isCall) { + this.isCall = isCall; + } + + + public XrefFromBody isData(@javax.annotation.Nonnull Boolean isData) { + this.isData = isData; + return this; + } + + /** + * True when the xref targets data rather than code + * @return isData + */ + @javax.annotation.Nonnull + public Boolean getIsData() { + return isData; + } + + public void setIsData(@javax.annotation.Nonnull Boolean isData) { + this.isData = isData; + } + + + public XrefFromBody isScalar(@javax.annotation.Nonnull Boolean isScalar) { + this.isScalar = isScalar; + return this; + } + + /** + * True when the xref is a scalar constant + * @return isScalar + */ + @javax.annotation.Nonnull + public Boolean getIsScalar() { + return isScalar; + } + + public void setIsScalar(@javax.annotation.Nonnull Boolean isScalar) { + this.isScalar = isScalar; + } + + + public XrefFromBody isString(@javax.annotation.Nonnull Boolean isString) { + this.isString = isString; + return this; + } + + /** + * True when the xref targets a string + * @return isString + */ + @javax.annotation.Nonnull + public Boolean getIsString() { + return isString; + } + + public void setIsString(@javax.annotation.Nonnull Boolean isString) { + this.isString = isString; + } + + + public XrefFromBody origStrEncoding(@javax.annotation.Nullable String origStrEncoding) { + this.origStrEncoding = origStrEncoding; + return this; + } + + /** + * String encoding, set only when is_string is true + * @return origStrEncoding + */ + @javax.annotation.Nullable + public String getOrigStrEncoding() { + return origStrEncoding; + } + + public void setOrigStrEncoding(@javax.annotation.Nullable String origStrEncoding) { + this.origStrEncoding = origStrEncoding; + } + + + public XrefFromBody rawData(@javax.annotation.Nullable String rawData) { + this.rawData = rawData; + return this; + } + + /** + * Raw bytes at the xref target, when captured + * @return rawData + */ + @javax.annotation.Nullable + public String getRawData() { + return rawData; + } + + public void setRawData(@javax.annotation.Nullable String rawData) { + this.rawData = rawData; + } + + + public XrefFromBody segment(@javax.annotation.Nullable XrefSegmentBody segment) { + this.segment = segment; + return this; + } + + /** + * Memory segment the xref target sits in + * @return segment + */ + @javax.annotation.Nullable + public XrefSegmentBody getSegment() { + return segment; + } + + public void setSegment(@javax.annotation.Nullable XrefSegmentBody segment) { + this.segment = segment; + } + + + public XrefFromBody value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * The xref's resolved value, when the sequencer could determine one + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public XrefFromBody xrefTo(@javax.annotation.Nonnull Long xrefTo) { + this.xrefTo = xrefTo; + return this; + } + + /** + * Address the reference targets + * @return xrefTo + */ + @javax.annotation.Nonnull + public Long getXrefTo() { + return xrefTo; + } + + public void setXrefTo(@javax.annotation.Nonnull Long xrefTo) { + this.xrefTo = xrefTo; + } + + /** + * 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 XrefFromBody instance itself + */ + public XrefFromBody 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; + } + XrefFromBody xrefFromBody = (XrefFromBody) o; + return Objects.equals(this.isCall, xrefFromBody.isCall) && + Objects.equals(this.isData, xrefFromBody.isData) && + Objects.equals(this.isScalar, xrefFromBody.isScalar) && + Objects.equals(this.isString, xrefFromBody.isString) && + Objects.equals(this.origStrEncoding, xrefFromBody.origStrEncoding) && + Objects.equals(this.rawData, xrefFromBody.rawData) && + Objects.equals(this.segment, xrefFromBody.segment) && + Objects.equals(this.value, xrefFromBody.value) && + Objects.equals(this.xrefTo, xrefFromBody.xrefTo)&& + Objects.equals(this.additionalProperties, xrefFromBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isCall, isData, isScalar, isString, origStrEncoding, rawData, segment, value, xrefTo, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XrefFromBody {\n"); + sb.append(" isCall: ").append(toIndentedString(isCall)).append("\n"); + sb.append(" isData: ").append(toIndentedString(isData)).append("\n"); + sb.append(" isScalar: ").append(toIndentedString(isScalar)).append("\n"); + sb.append(" isString: ").append(toIndentedString(isString)).append("\n"); + sb.append(" origStrEncoding: ").append(toIndentedString(origStrEncoding)).append("\n"); + sb.append(" rawData: ").append(toIndentedString(rawData)).append("\n"); + sb.append(" segment: ").append(toIndentedString(segment)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" xrefTo: ").append(toIndentedString(xrefTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("is_call", "is_data", "is_scalar", "is_string", "orig_str_encoding", "raw_data", "segment", "value", "xref_to")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("is_call", "is_data", "is_scalar", "is_string", "xref_to")); + } + + /** + * 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 XrefFromBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!XrefFromBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in XrefFromBody is not found in the empty JSON string", XrefFromBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : XrefFromBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("orig_str_encoding") != null && !jsonObj.get("orig_str_encoding").isJsonNull()) && !jsonObj.get("orig_str_encoding").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `orig_str_encoding` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orig_str_encoding").toString())); + } + if ((jsonObj.get("raw_data") != null && !jsonObj.get("raw_data").isJsonNull()) && !jsonObj.get("raw_data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `raw_data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("raw_data").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!XrefFromBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XrefFromBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XrefFromBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, XrefFromBody 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 XrefFromBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XrefFromBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of XrefFromBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of XrefFromBody + * @throws IOException if the JSON string is invalid with respect to XrefFromBody + */ + public static XrefFromBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XrefFromBody.class); + } + + /** + * Convert an instance of XrefFromBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/XrefIntoBody.java b/src/main/java/ai/reveng/model/XrefIntoBody.java new file mode 100644 index 0000000..0f9df3d --- /dev/null +++ b/src/main/java/ai/reveng/model/XrefIntoBody.java @@ -0,0 +1,504 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.XrefSegmentBody; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * XrefIntoBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class XrefIntoBody { + public static final String SERIALIZED_NAME_IS_CALL = "is_call"; + @SerializedName(SERIALIZED_NAME_IS_CALL) + @javax.annotation.Nonnull + private Boolean isCall; + + public static final String SERIALIZED_NAME_IS_DATA = "is_data"; + @SerializedName(SERIALIZED_NAME_IS_DATA) + @javax.annotation.Nonnull + private Boolean isData; + + public static final String SERIALIZED_NAME_IS_SCALAR = "is_scalar"; + @SerializedName(SERIALIZED_NAME_IS_SCALAR) + @javax.annotation.Nonnull + private Boolean isScalar; + + public static final String SERIALIZED_NAME_IS_STRING = "is_string"; + @SerializedName(SERIALIZED_NAME_IS_STRING) + @javax.annotation.Nonnull + private Boolean isString; + + public static final String SERIALIZED_NAME_ORIG_STR_ENCODING = "orig_str_encoding"; + @SerializedName(SERIALIZED_NAME_ORIG_STR_ENCODING) + @javax.annotation.Nullable + private String origStrEncoding; + + public static final String SERIALIZED_NAME_RAW_DATA = "raw_data"; + @SerializedName(SERIALIZED_NAME_RAW_DATA) + @javax.annotation.Nullable + private String rawData; + + public static final String SERIALIZED_NAME_SEGMENT = "segment"; + @SerializedName(SERIALIZED_NAME_SEGMENT) + @javax.annotation.Nullable + private XrefSegmentBody segment; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_XREF_FROM = "xref_from"; + @SerializedName(SERIALIZED_NAME_XREF_FROM) + @javax.annotation.Nonnull + private Long xrefFrom; + + public XrefIntoBody() { + } + + public XrefIntoBody isCall(@javax.annotation.Nonnull Boolean isCall) { + this.isCall = isCall; + return this; + } + + /** + * True when the xref is a call instruction + * @return isCall + */ + @javax.annotation.Nonnull + public Boolean getIsCall() { + return isCall; + } + + public void setIsCall(@javax.annotation.Nonnull Boolean isCall) { + this.isCall = isCall; + } + + + public XrefIntoBody isData(@javax.annotation.Nonnull Boolean isData) { + this.isData = isData; + return this; + } + + /** + * True when the xref targets data rather than code + * @return isData + */ + @javax.annotation.Nonnull + public Boolean getIsData() { + return isData; + } + + public void setIsData(@javax.annotation.Nonnull Boolean isData) { + this.isData = isData; + } + + + public XrefIntoBody isScalar(@javax.annotation.Nonnull Boolean isScalar) { + this.isScalar = isScalar; + return this; + } + + /** + * True when the xref is a scalar constant + * @return isScalar + */ + @javax.annotation.Nonnull + public Boolean getIsScalar() { + return isScalar; + } + + public void setIsScalar(@javax.annotation.Nonnull Boolean isScalar) { + this.isScalar = isScalar; + } + + + public XrefIntoBody isString(@javax.annotation.Nonnull Boolean isString) { + this.isString = isString; + return this; + } + + /** + * True when the xref targets a string + * @return isString + */ + @javax.annotation.Nonnull + public Boolean getIsString() { + return isString; + } + + public void setIsString(@javax.annotation.Nonnull Boolean isString) { + this.isString = isString; + } + + + public XrefIntoBody origStrEncoding(@javax.annotation.Nullable String origStrEncoding) { + this.origStrEncoding = origStrEncoding; + return this; + } + + /** + * String encoding, set only when is_string is true + * @return origStrEncoding + */ + @javax.annotation.Nullable + public String getOrigStrEncoding() { + return origStrEncoding; + } + + public void setOrigStrEncoding(@javax.annotation.Nullable String origStrEncoding) { + this.origStrEncoding = origStrEncoding; + } + + + public XrefIntoBody rawData(@javax.annotation.Nullable String rawData) { + this.rawData = rawData; + return this; + } + + /** + * Raw bytes at the xref target, when captured + * @return rawData + */ + @javax.annotation.Nullable + public String getRawData() { + return rawData; + } + + public void setRawData(@javax.annotation.Nullable String rawData) { + this.rawData = rawData; + } + + + public XrefIntoBody segment(@javax.annotation.Nullable XrefSegmentBody segment) { + this.segment = segment; + return this; + } + + /** + * Memory segment the xref target sits in + * @return segment + */ + @javax.annotation.Nullable + public XrefSegmentBody getSegment() { + return segment; + } + + public void setSegment(@javax.annotation.Nullable XrefSegmentBody segment) { + this.segment = segment; + } + + + public XrefIntoBody value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * The xref's resolved value, when the sequencer could determine one + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public XrefIntoBody xrefFrom(@javax.annotation.Nonnull Long xrefFrom) { + this.xrefFrom = xrefFrom; + return this; + } + + /** + * Address the reference originates from + * @return xrefFrom + */ + @javax.annotation.Nonnull + public Long getXrefFrom() { + return xrefFrom; + } + + public void setXrefFrom(@javax.annotation.Nonnull Long xrefFrom) { + this.xrefFrom = xrefFrom; + } + + /** + * 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 XrefIntoBody instance itself + */ + public XrefIntoBody 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; + } + XrefIntoBody xrefIntoBody = (XrefIntoBody) o; + return Objects.equals(this.isCall, xrefIntoBody.isCall) && + Objects.equals(this.isData, xrefIntoBody.isData) && + Objects.equals(this.isScalar, xrefIntoBody.isScalar) && + Objects.equals(this.isString, xrefIntoBody.isString) && + Objects.equals(this.origStrEncoding, xrefIntoBody.origStrEncoding) && + Objects.equals(this.rawData, xrefIntoBody.rawData) && + Objects.equals(this.segment, xrefIntoBody.segment) && + Objects.equals(this.value, xrefIntoBody.value) && + Objects.equals(this.xrefFrom, xrefIntoBody.xrefFrom)&& + Objects.equals(this.additionalProperties, xrefIntoBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isCall, isData, isScalar, isString, origStrEncoding, rawData, segment, value, xrefFrom, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XrefIntoBody {\n"); + sb.append(" isCall: ").append(toIndentedString(isCall)).append("\n"); + sb.append(" isData: ").append(toIndentedString(isData)).append("\n"); + sb.append(" isScalar: ").append(toIndentedString(isScalar)).append("\n"); + sb.append(" isString: ").append(toIndentedString(isString)).append("\n"); + sb.append(" origStrEncoding: ").append(toIndentedString(origStrEncoding)).append("\n"); + sb.append(" rawData: ").append(toIndentedString(rawData)).append("\n"); + sb.append(" segment: ").append(toIndentedString(segment)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" xrefFrom: ").append(toIndentedString(xrefFrom)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("is_call", "is_data", "is_scalar", "is_string", "orig_str_encoding", "raw_data", "segment", "value", "xref_from")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("is_call", "is_data", "is_scalar", "is_string", "xref_from")); + } + + /** + * 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 XrefIntoBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!XrefIntoBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in XrefIntoBody is not found in the empty JSON string", XrefIntoBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : XrefIntoBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("orig_str_encoding") != null && !jsonObj.get("orig_str_encoding").isJsonNull()) && !jsonObj.get("orig_str_encoding").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `orig_str_encoding` to be a primitive type in the JSON string but got `%s`", jsonObj.get("orig_str_encoding").toString())); + } + if ((jsonObj.get("raw_data") != null && !jsonObj.get("raw_data").isJsonNull()) && !jsonObj.get("raw_data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `raw_data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("raw_data").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!XrefIntoBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XrefIntoBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XrefIntoBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, XrefIntoBody 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 XrefIntoBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XrefIntoBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of XrefIntoBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of XrefIntoBody + * @throws IOException if the JSON string is invalid with respect to XrefIntoBody + */ + public static XrefIntoBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XrefIntoBody.class); + } + + /** + * Convert an instance of XrefIntoBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/XrefSegmentBody.java b/src/main/java/ai/reveng/model/XrefSegmentBody.java new file mode 100644 index 0000000..5696811 --- /dev/null +++ b/src/main/java/ai/reveng/model/XrefSegmentBody.java @@ -0,0 +1,506 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * XrefSegmentBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class XrefSegmentBody { + public static final String SERIALIZED_NAME_END = "end"; + @SerializedName(SERIALIZED_NAME_END) + @javax.annotation.Nonnull + private Long end; + + public static final String SERIALIZED_NAME_EXEC = "exec"; + @SerializedName(SERIALIZED_NAME_EXEC) + @javax.annotation.Nonnull + private Boolean exec; + + /** + * Coarse classification of the segment + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + CODE("code"), + + DATA("data"), + + OTHER("other"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.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 KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_READ = "read"; + @SerializedName(SERIALIZED_NAME_READ) + @javax.annotation.Nonnull + private Boolean read; + + public static final String SERIALIZED_NAME_START = "start"; + @SerializedName(SERIALIZED_NAME_START) + @javax.annotation.Nonnull + private Long start; + + public static final String SERIALIZED_NAME_WRITE = "write"; + @SerializedName(SERIALIZED_NAME_WRITE) + @javax.annotation.Nonnull + private Boolean write; + + public XrefSegmentBody() { + } + + public XrefSegmentBody end(@javax.annotation.Nonnull Long end) { + this.end = end; + return this; + } + + /** + * End address of the segment, inclusive + * @return end + */ + @javax.annotation.Nonnull + public Long getEnd() { + return end; + } + + public void setEnd(@javax.annotation.Nonnull Long end) { + this.end = end; + } + + + public XrefSegmentBody exec(@javax.annotation.Nonnull Boolean exec) { + this.exec = exec; + return this; + } + + /** + * True when the segment is executable + * @return exec + */ + @javax.annotation.Nonnull + public Boolean getExec() { + return exec; + } + + public void setExec(@javax.annotation.Nonnull Boolean exec) { + this.exec = exec; + } + + + public XrefSegmentBody kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Coarse classification of the segment + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public XrefSegmentBody name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Segment name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public XrefSegmentBody read(@javax.annotation.Nonnull Boolean read) { + this.read = read; + return this; + } + + /** + * True when the segment is readable + * @return read + */ + @javax.annotation.Nonnull + public Boolean getRead() { + return read; + } + + public void setRead(@javax.annotation.Nonnull Boolean read) { + this.read = read; + } + + + public XrefSegmentBody start(@javax.annotation.Nonnull Long start) { + this.start = start; + return this; + } + + /** + * Start address of the segment + * @return start + */ + @javax.annotation.Nonnull + public Long getStart() { + return start; + } + + public void setStart(@javax.annotation.Nonnull Long start) { + this.start = start; + } + + + public XrefSegmentBody write(@javax.annotation.Nonnull Boolean write) { + this.write = write; + return this; + } + + /** + * True when the segment is writable + * @return write + */ + @javax.annotation.Nonnull + public Boolean getWrite() { + return write; + } + + public void setWrite(@javax.annotation.Nonnull Boolean write) { + this.write = write; + } + + /** + * 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 XrefSegmentBody instance itself + */ + public XrefSegmentBody 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; + } + XrefSegmentBody xrefSegmentBody = (XrefSegmentBody) o; + return Objects.equals(this.end, xrefSegmentBody.end) && + Objects.equals(this.exec, xrefSegmentBody.exec) && + Objects.equals(this.kind, xrefSegmentBody.kind) && + Objects.equals(this.name, xrefSegmentBody.name) && + Objects.equals(this.read, xrefSegmentBody.read) && + Objects.equals(this.start, xrefSegmentBody.start) && + Objects.equals(this.write, xrefSegmentBody.write)&& + Objects.equals(this.additionalProperties, xrefSegmentBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(end, exec, kind, name, read, start, write, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class XrefSegmentBody {\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" exec: ").append(toIndentedString(exec)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" read: ").append(toIndentedString(read)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" write: ").append(toIndentedString(write)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("end", "exec", "kind", "name", "read", "start", "write")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("end", "exec", "kind", "name", "read", "start", "write")); + } + + /** + * 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 XrefSegmentBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!XrefSegmentBody.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in XrefSegmentBody is not found in the empty JSON string", XrefSegmentBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : XrefSegmentBody.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!XrefSegmentBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'XrefSegmentBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(XrefSegmentBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, XrefSegmentBody 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 XrefSegmentBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + XrefSegmentBody instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of XrefSegmentBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of XrefSegmentBody + * @throws IOException if the JSON string is invalid with respect to XrefSegmentBody + */ + public static XrefSegmentBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, XrefSegmentBody.class); + } + + /** + * Convert an instance of XrefSegmentBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +