diff --git a/.sdk-version b/.sdk-version index 18ef788..90009ae 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v4.60.1 +v4.64.0 diff --git a/README.md b/README.md index 46480fe..509dd48 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 4.60.1 + 4.64.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:4.60.1" + implementation "ai.reveng:sdk:4.64.0" } ``` @@ -162,7 +162,6 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**updateAnalysis**](docs/AnalysesCoreApi.md#updateAnalysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis *AnalysesCoreApi* | [**updateAnalysisTags**](docs/AnalysesCoreApi.md#updateAnalysisTags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags *AnalysesCoreApi* | [**uploadFile**](docs/AnalysesCoreApi.md#uploadFile) | **POST** /v2/upload | Upload File -*AnalysesCoreApi* | [**v3CreateAnalysis**](docs/AnalysesCoreApi.md#v3CreateAnalysis) | **POST** /v3/analyses | Create an analysis *AnalysesCoreApi* | [**v3DeleteAnalysis**](docs/AnalysesCoreApi.md#v3DeleteAnalysis) | **DELETE** /v3/analyses/{analysis_id} | Delete an analysis. *AnalysesCoreApi* | [**v3DownloadBinaryExport**](docs/AnalysesCoreApi.md#v3DownloadBinaryExport) | **GET** /v3/analyses/{analysis_id}/binary-export | Download a binary export *AnalysesCoreApi* | [**v3GetAnalysis**](docs/AnalysesCoreApi.md#v3GetAnalysis) | **GET** /v3/analyses/{analysis_id} | Get an analysis. @@ -192,6 +191,9 @@ Class | Method | HTTP request | Description *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 *AuthenticationUsersApi* | [**submitUserFeedback**](docs/AuthenticationUsersApi.md#submitUserFeedback) | **POST** /v2/users/feedback | Submit feedback about the application +*AuthenticationUsersApi* | [**v3GetUser**](docs/AuthenticationUsersApi.md#v3GetUser) | **GET** /v3/users/{user_id} | Get a user's public information +*AuthenticationUsersApi* | [**v3GetUserActivity**](docs/AuthenticationUsersApi.md#v3GetUserActivity) | **GET** /v3/users/activity | Get the caller's activity feed +*AuthenticationUsersApi* | [**v3SubmitUserFeedback**](docs/AuthenticationUsersApi.md#v3SubmitUserFeedback) | **POST** /v3/users/feedback | Submit feedback *BinariesApi* | [**downloadZippedBinary**](docs/BinariesApi.md#downloadZippedBinary) | **GET** /v2/binaries/{binary_id}/download-zipped | Downloads a zipped binary with password protection *BinariesApi* | [**getBinaryAdditionalDetails**](docs/BinariesApi.md#getBinaryAdditionalDetails) | **GET** /v2/binaries/{binary_id}/additional-details | Gets the additional details of a binary *BinariesApi* | [**getBinaryAdditionalDetailsStatus**](docs/BinariesApi.md#getBinaryAdditionalDetailsStatus) | **GET** /v2/binaries/{binary_id}/additional-details/status | Gets the status of the additional details task for a binary @@ -249,6 +251,8 @@ Class | Method | HTTP request | Description *ExternalSourcesApi* | [**createExternalTaskVt**](docs/ExternalSourcesApi.md#createExternalTaskVt) | **POST** /v2/analysis/{analysis_id}/external/vt | Pulls data from VirusTotal *ExternalSourcesApi* | [**getVtData**](docs/ExternalSourcesApi.md#getVtData) | **GET** /v2/analysis/{analysis_id}/external/vt | Get VirusTotal data *ExternalSourcesApi* | [**getVtTaskStatus**](docs/ExternalSourcesApi.md#getVtTaskStatus) | **GET** /v2/analysis/{analysis_id}/external/vt/status | Check the status of VirusTotal data retrieval +*ExternalSourcesApi* | [**v3GetVirustotalScanOperation**](docs/ExternalSourcesApi.md#v3GetVirustotalScanOperation) | **GET** /v3/operations/virustotal-scan/{binary_id} | Get a VirusTotal scan operation. +*ExternalSourcesApi* | [**v3RunVirustotalScan**](docs/ExternalSourcesApi.md#v3RunVirustotalScan) | **POST** /v3/binaries/{binary_id}/virustotal-scan:run | Trigger a VirusTotal lookup for a binary. *FunctionsAiDecompilationApi* | [**createAiDecompilation**](docs/FunctionsAiDecompilationApi.md#createAiDecompilation) | **POST** /v3/functions/{function_id}/ai-decompilation | Start AI decompilation *FunctionsAiDecompilationApi* | [**deleteAiDecompilationInlineComment**](docs/FunctionsAiDecompilationApi.md#deleteAiDecompilationInlineComment) | **DELETE** /v3/functions/{function_id}/ai-decompilation/inline-comments/{line} | Delete a single inline comment *FunctionsAiDecompilationApi* | [**getAiDecompilation**](docs/FunctionsAiDecompilationApi.md#getAiDecompilation) | **GET** /v3/functions/{function_id}/ai-decompilation | Get AI decompilation result @@ -265,9 +269,11 @@ Class | Method | HTTP request | Description *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* | [**v3GetAiDecompilationRating**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationRating) | **GET** /v3/functions/{function_id}/ai-decompilation/rating | Get AI decompilation rating *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTokens**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides *FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTypeSuggestions**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestions) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Get AI decompilation type suggestions *FunctionsAiDecompilationApi* | [**v3UpsertAiDecompilationOverrides**](docs/FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides +*FunctionsAiDecompilationApi* | [**v3UpsertAiDecompilationRating**](docs/FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationRating) | **PATCH** /v3/functions/{function_id}/ai-decompilation/rating | Upsert AI decompilation rating *FunctionsCoreApi* | [**addFunctionCallee**](docs/FunctionsCoreApi.md#addFunctionCallee) | **POST** /v3/functions/{function_id}/callees | Add a callee to a function *FunctionsCoreApi* | [**addUserStringToFunction**](docs/FunctionsCoreApi.md#addUserStringToFunction) | **POST** /v3/functions/{function_id}/user-provided-strings | Add a user-provided string to a function. *FunctionsCoreApi* | [**getAnalysisStrings**](docs/FunctionsCoreApi.md#getAnalysisStrings) | **GET** /v2/analyses/{analysis_id}/functions/strings | Get string information found in the Analysis @@ -292,6 +298,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* | [**v3GetAnalysisFuncMaps**](docs/FunctionsCoreApi.md#v3GetAnalysisFuncMaps) | **GET** /v3/analyses/{analysis_id}/func-maps | Get function ID/address maps for an analysis *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 @@ -319,6 +326,7 @@ Class | Method | HTTP request | Description - [AcceptTypeSuggestionsInputBody](docs/AcceptTypeSuggestionsInputBody.md) - [AcceptTypeSuggestionsOutputBody](docs/AcceptTypeSuggestionsOutputBody.md) - [AcceptedType](docs/AcceptedType.md) + - [ActivityBody](docs/ActivityBody.md) - [AddCalleeInputBody](docs/AddCalleeInputBody.md) - [AddCollectionBinariesInputBody](docs/AddCollectionBinariesInputBody.md) - [AddIssuerDomainInputBody](docs/AddIssuerDomainInputBody.md) @@ -372,6 +380,7 @@ Class | Method | HTTP request | Description - [AnalysisXrefOutputBody](docs/AnalysisXrefOutputBody.md) - [ApiCall](docs/ApiCall.md) - [ApiCombinationEvidence](docs/ApiCombinationEvidence.md) + - [ApiKeyBody](docs/ApiKeyBody.md) - [AppApiRestV2AgentSchemaCapability](docs/AppApiRestV2AgentSchemaCapability.md) - [AppApiRestV2AnalysesEnumsOrderBy](docs/AppApiRestV2AnalysesEnumsOrderBy.md) - [AppApiRestV2CollectionsEnumsOrderBy](docs/AppApiRestV2CollectionsEnumsOrderBy.md) @@ -550,6 +559,7 @@ Class | Method | HTTP request | Description - [CreatePortalSessionInputBody](docs/CreatePortalSessionInputBody.md) - [CreateRequest](docs/CreateRequest.md) - [CreateResult](docs/CreateResult.md) + - [CreateSecretStoreInputBody](docs/CreateSecretStoreInputBody.md) - [CreateStructDataType](docs/CreateStructDataType.md) - [CreateTeamInputBody](docs/CreateTeamInputBody.md) - [CreateTypedefDataType](docs/CreateTypedefDataType.md) @@ -700,6 +710,7 @@ Class | Method | HTTP request | Description - [FunctionsListRename](docs/FunctionsListRename.md) - [FunctionsProgressOutputBody](docs/FunctionsProgressOutputBody.md) - [GeneratePDFOutputBody](docs/GeneratePDFOutputBody.md) + - [GetAPIKeysOutputBody](docs/GetAPIKeysOutputBody.md) - [GetAdditionalDetailsOutputBody](docs/GetAdditionalDetailsOutputBody.md) - [GetAdditionalDetailsStatusOutputBody](docs/GetAdditionalDetailsStatusOutputBody.md) - [GetAiDecompilationRatingResponse](docs/GetAiDecompilationRatingResponse.md) @@ -710,16 +721,19 @@ Class | Method | HTTP request | Description - [GetConfigOutputBody](docs/GetConfigOutputBody.md) - [GetDataTypeHistoryBody](docs/GetDataTypeHistoryBody.md) - [GetDieInfoOutputBody](docs/GetDieInfoOutputBody.md) + - [GetFunctionMapsOutputBody](docs/GetFunctionMapsOutputBody.md) - [GetFunctionSignatureHistoryBody](docs/GetFunctionSignatureHistoryBody.md) - [GetMatchesOutputBody](docs/GetMatchesOutputBody.md) - [GetMatchesStatusOutputBody](docs/GetMatchesStatusOutputBody.md) - [GetModelsOutputBody](docs/GetModelsOutputBody.md) - [GetProductsOutputBody](docs/GetProductsOutputBody.md) + - [GetPublicUserOutputBody](docs/GetPublicUserOutputBody.md) - [GetPublicUserResponse](docs/GetPublicUserResponse.md) - [GetRelatedBinariesOutputBody](docs/GetRelatedBinariesOutputBody.md) - [GetRelatedStatusOutputBody](docs/GetRelatedStatusOutputBody.md) - [GetSubscriptionOutputBody](docs/GetSubscriptionOutputBody.md) - [GetTokensResponse](docs/GetTokensResponse.md) + - [GetUserActivityOutputBody](docs/GetUserActivityOutputBody.md) - [HardcodedSecretEvidence](docs/HardcodedSecretEvidence.md) - [HistoryActor](docs/HistoryActor.md) - [HistoryEntry](docs/HistoryEntry.md) @@ -756,6 +770,7 @@ Class | Method | HTTP request | Description - [ListFunctionSignaturesOutputBody](docs/ListFunctionSignaturesOutputBody.md) - [ListFunctionStringsOutputBody](docs/ListFunctionStringsOutputBody.md) - [ListImportedFunctionsOutputBody](docs/ListImportedFunctionsOutputBody.md) + - [ListSecretStoreOutputBody](docs/ListSecretStoreOutputBody.md) - [ListTeamsOutputBody](docs/ListTeamsOutputBody.md) - [ListUsersOutputBody](docs/ListUsersOutputBody.md) - [LocationOutputBody](docs/LocationOutputBody.md) @@ -805,6 +820,7 @@ Class | Method | HTTP request | Description - [OperationNetworkingExplainMetadataNetworkingExplainResult](docs/OperationNetworkingExplainMetadataNetworkingExplainResult.md) - [OperationNetworkingScanMetadataNetworkingScanResult](docs/OperationNetworkingScanMetadataNetworkingScanResult.md) - [OperationSecurityScanMetadataSecurityScanResult](docs/OperationSecurityScanMetadataSecurityScanResult.md) + - [OperationVirusTotalScanMetadataVirusTotalScanResult](docs/OperationVirusTotalScanMetadataVirusTotalScanResult.md) - [OperationWorkflowProgressResultBody](docs/OperationWorkflowProgressResultBody.md) - [Order](docs/Order.md) - [Organisation](docs/Organisation.md) @@ -841,6 +857,7 @@ Class | Method | HTTP request | Description - [ProtocolsAgentResponse](docs/ProtocolsAgentResponse.md) - [PutAnalysisStringsRequest](docs/PutAnalysisStringsRequest.md) - [QueuedWorkflowTaskResponse](docs/QueuedWorkflowTaskResponse.md) + - [RatingOutputBody](docs/RatingOutputBody.md) - [ReAnalysisForm](docs/ReAnalysisForm.md) - [Recent](docs/Recent.md) - [ReferencedConstant](docs/ReferencedConstant.md) @@ -867,6 +884,7 @@ Class | Method | HTTP request | Description - [ReportReachabilityStatus](docs/ReportReachabilityStatus.md) - [ReportResult](docs/ReportResult.md) - [RequestedConfigBody](docs/RequestedConfigBody.md) + - [ResendVerificationEmailInputBody](docs/ResendVerificationEmailInputBody.md) - [ResolvedEntity](docs/ResolvedEntity.md) - [ResultBody](docs/ResultBody.md) - [RevokeBody](docs/RevokeBody.md) @@ -884,6 +902,7 @@ Class | Method | HTTP request | Description - [SearchBinariesOutputBody](docs/SearchBinariesOutputBody.md) - [SearchFunctionsOutputBody](docs/SearchFunctionsOutputBody.md) - [SearchTagsOutputBody](docs/SearchTagsOutputBody.md) + - [SecretBody](docs/SecretBody.md) - [SecretsAgentResponse](docs/SecretsAgentResponse.md) - [SectionModel](docs/SectionModel.md) - [SecurityFinding](docs/SecurityFinding.md) @@ -945,7 +964,9 @@ Class | Method | HTTP request | Description - [SubjectAnyOf1](docs/SubjectAnyOf1.md) - [SubjectAnyOf2](docs/SubjectAnyOf2.md) - [SubjectAnyOf3](docs/SubjectAnyOf3.md) + - [SubmitFeedbackBody](docs/SubmitFeedbackBody.md) - [SubmitFeedbackInputBody](docs/SubmitFeedbackInputBody.md) + - [SubmitFeedbackOutputBody](docs/SubmitFeedbackOutputBody.md) - [SubmitUserFeedbackRequest](docs/SubmitUserFeedbackRequest.md) - [SuggestedHole](docs/SuggestedHole.md) - [SuggestedMemberView](docs/SuggestedMemberView.md) @@ -1007,6 +1028,7 @@ Class | Method | HTTP request | Description - [UpdatePasswordInputBody](docs/UpdatePasswordInputBody.md) - [UpdatePointerDataType](docs/UpdatePointerDataType.md) - [UpdateProfileInputBody](docs/UpdateProfileInputBody.md) + - [UpdateSecretStoreInputBody](docs/UpdateSecretStoreInputBody.md) - [UpdateStructDataType](docs/UpdateStructDataType.md) - [UpdateTagsInputBody](docs/UpdateTagsInputBody.md) - [UpdateTeamInputBody](docs/UpdateTeamInputBody.md) @@ -1023,11 +1045,14 @@ Class | Method | HTTP request | Description - [UpsertAiDecomplationRatingRequest](docs/UpsertAiDecomplationRatingRequest.md) - [UpsertOverridesData](docs/UpsertOverridesData.md) - [UpsertOverridesInputBody](docs/UpsertOverridesInputBody.md) + - [UpsertRatingInputBody](docs/UpsertRatingInputBody.md) - [User](docs/User.md) - [UserActivityResponse](docs/UserActivityResponse.md) - [UserCredits](docs/UserCredits.md) - [UserIdentity](docs/UserIdentity.md) - [UserProfile](docs/UserProfile.md) + - [VirusTotalScanMetadata](docs/VirusTotalScanMetadata.md) + - [VirusTotalScanResult](docs/VirusTotalScanResult.md) - [WarningEvent](docs/WarningEvent.md) - [WorkflowDayBody](docs/WorkflowDayBody.md) - [WorkflowProgress](docs/WorkflowProgress.md) diff --git a/build.gradle b/build.gradle index 0da4aa8..c64a58b 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '4.60.1' +version = '4.64.0' @@ -174,7 +174,7 @@ mavenPublishing { // key, and signing without one fails the build. if (project.hasProperty("signingInMemoryKey")) signAllPublications() - coordinates("ai.reveng", "sdk", "4.60.1") + coordinates("ai.reveng", "sdk", "4.64.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index 139d375..2ec4090 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.60.1", + version := "4.64.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/ActivityBody.md b/docs/ActivityBody.md new file mode 100644 index 0000000..674bd41 --- /dev/null +++ b/docs/ActivityBody.md @@ -0,0 +1,62 @@ + + +# ActivityBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**actions** | [**ActionsEnum**](#ActionsEnum) | The kind of action taken | | +|**activityScope** | [**ActivityScopeEnum**](#ActivityScopeEnum) | Who can see this activity entry | | +|**createdAt** | **OffsetDateTime** | When the action happened | | +|**message** | **String** | Human-readable description of the action | | +|**sources** | [**SourcesEnum**](#SourcesEnum) | The resource kind the action applied to | | +|**username** | **String** | The user who performed the action | | + + + +## Enum: ActionsEnum + +| Name | Value | +|---- | -----| +| UPLOADED | "UPLOADED" | +| COMPLETED | "COMPLETED" | +| CREATED | "CREATED" | +| REGISTERED | "REGISTERED" | +| REPUTATION | "REPUTATION" | +| LEADERBOARD | "LEADERBOARD" | +| EDITED | "EDITED" | +| DELETED | "DELETED" | +| ERROR | "ERROR" | +| RENAME | "RENAME" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: ActivityScopeEnum + +| Name | Value | +|---- | -----| +| PUBLIC | "PUBLIC" | +| PRIVATE | "PRIVATE" | +| TEAM | "TEAM" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourcesEnum + +| Name | Value | +|---- | -----| +| USERS | "USERS" | +| ANALYSES | "ANALYSES" | +| MATCHES | "MATCHES" | +| COLLECTIONS | "COLLECTIONS" | +| HISTORY | "HISTORY" | +| FILES | "FILES" | +| FUNCTION | "FUNCTION" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index f663ffd..662c4ea 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -27,7 +27,6 @@ All URIs are relative to *https://api.reveng.ai* | [**updateAnalysis**](AnalysesCoreApi.md#updateAnalysis) | **PATCH** /v2/analyses/{analysis_id} | Update Analysis | | [**updateAnalysisTags**](AnalysesCoreApi.md#updateAnalysisTags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags | | [**uploadFile**](AnalysesCoreApi.md#uploadFile) | **POST** /v2/upload | Upload File | -| [**v3CreateAnalysis**](AnalysesCoreApi.md#v3CreateAnalysis) | **POST** /v3/analyses | Create an analysis | | [**v3DeleteAnalysis**](AnalysesCoreApi.md#v3DeleteAnalysis) | **DELETE** /v3/analyses/{analysis_id} | Delete an analysis. | | [**v3DownloadBinaryExport**](AnalysesCoreApi.md#v3DownloadBinaryExport) | **GET** /v3/analyses/{analysis_id}/binary-export | Download a binary export | | [**v3GetAnalysis**](AnalysesCoreApi.md#v3GetAnalysis) | **GET** /v3/analyses/{analysis_id} | Get an analysis. | @@ -1830,89 +1829,6 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | - -# **v3CreateAnalysis** -> OperationCreateMetadataCreateResult v3CreateAnalysis(createRequest, xRevEngApplication) - -Create an analysis - -Queues a new Analysis for an uploaded Binary and returns the created Operation. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `402` [`INSUFFICIENT_CREDITS`](/errors/INSUFFICIENT_CREDITS) — Insufficient Credits - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `413` [`REQUEST_ENTITY_TOO_LARGE`](/errors/REQUEST_ENTITY_TOO_LARGE) — Request Entity Too Large - -### 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); - CreateRequest createRequest = new CreateRequest(); // CreateRequest | - String xRevEngApplication = "xRevEngApplication_example"; // String | Identifies the calling RevEng application. Recorded on the Analysis log. - try { - OperationCreateMetadataCreateResult result = apiInstance.v3CreateAnalysis(createRequest, xRevEngApplication); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling AnalysesCoreApi#v3CreateAnalysis"); - 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 | -|------------- | ------------- | ------------- | -------------| -| **createRequest** | [**CreateRequest**](CreateRequest.md)| | | -| **xRevEngApplication** | **String**| Identifies the calling RevEng application. Recorded on the Analysis log. | [optional] | - -### Return type - -[**OperationCreateMetadataCreateResult**](OperationCreateMetadataCreateResult.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 | -|-------------|-------------|------------------| -| **201** | Created | - | -| **400** | Bad Request | - | -| **402** | Payment Required | - | -| **403** | Forbidden | - | -| **404** | Not Found | - | -| **409** | Conflict | - | -| **413** | Request Entity Too Large | - | -| **422** | Unprocessable Entity | - | -| **500** | Internal Server Error | - | - # **v3DeleteAnalysis** > v3DeleteAnalysis(analysisId) diff --git a/docs/ApiKeyBody.md b/docs/ApiKeyBody.md new file mode 100644 index 0000000..c7dcfd2 --- /dev/null +++ b/docs/ApiKeyBody.md @@ -0,0 +1,13 @@ + + +# ApiKeyBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**apiKey** | **String** | The API key | | + + + diff --git a/docs/AuthenticationUsersApi.md b/docs/AuthenticationUsersApi.md index 6a2d89c..0ab964d 100644 --- a/docs/AuthenticationUsersApi.md +++ b/docs/AuthenticationUsersApi.md @@ -7,6 +7,9 @@ All URIs are relative to *https://api.reveng.ai* | [**getUser**](AuthenticationUsersApi.md#getUser) | **GET** /v2/users/{user_id} | Get a user's public information | | [**getUserActivity**](AuthenticationUsersApi.md#getUserActivity) | **GET** /v2/users/activity | Get auth user activity | | [**submitUserFeedback**](AuthenticationUsersApi.md#submitUserFeedback) | **POST** /v2/users/feedback | Submit feedback about the application | +| [**v3GetUser**](AuthenticationUsersApi.md#v3GetUser) | **GET** /v3/users/{user_id} | Get a user's public information | +| [**v3GetUserActivity**](AuthenticationUsersApi.md#v3GetUserActivity) | **GET** /v3/users/activity | Get the caller's activity feed | +| [**v3SubmitUserFeedback**](AuthenticationUsersApi.md#v3SubmitUserFeedback) | **POST** /v3/users/feedback | Submit feedback | @@ -223,3 +226,225 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **v3GetUser** +> GetPublicUserOutputBody v3GetUser(userId) + +Get a user's public information + +Returns a user's username. Any authenticated caller may look up any user by ID. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AuthenticationUsersApi; + +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"); + + AuthenticationUsersApi apiInstance = new AuthenticationUsersApi(defaultClient); + Long userId = 56L; // Long | User ID + try { + GetPublicUserOutputBody result = apiInstance.v3GetUser(userId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationUsersApi#v3GetUser"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **userId** | **Long**| User ID | | + +### Return type + +[**GetPublicUserOutputBody**](GetPublicUserOutputBody.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 | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + + +# **v3GetUserActivity** +> GetUserActivityOutputBody v3GetUserActivity() + +Get the caller's activity feed + +Returns the caller's own recent activity, their team's, and everyone's public activity, newest first. + +### 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.AuthenticationUsersApi; + +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"); + + AuthenticationUsersApi apiInstance = new AuthenticationUsersApi(defaultClient); + try { + GetUserActivityOutputBody result = apiInstance.v3GetUserActivity(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationUsersApi#v3GetUserActivity"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**GetUserActivityOutputBody**](GetUserActivityOutputBody.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 | - | +| **0** | Error | - | + + +# **v3SubmitUserFeedback** +> SubmitFeedbackOutputBody v3SubmitUserFeedback(submitFeedbackBody) + +Submit feedback + +Submits feedback about the application to a Slack channel. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AuthenticationUsersApi; + +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"); + + AuthenticationUsersApi apiInstance = new AuthenticationUsersApi(defaultClient); + SubmitFeedbackBody submitFeedbackBody = new SubmitFeedbackBody(); // SubmitFeedbackBody | + try { + SubmitFeedbackOutputBody result = apiInstance.v3SubmitUserFeedback(submitFeedbackBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AuthenticationUsersApi#v3SubmitUserFeedback"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **submitFeedbackBody** | [**SubmitFeedbackBody**](SubmitFeedbackBody.md)| | | + +### Return type + +[**SubmitFeedbackOutputBody**](SubmitFeedbackOutputBody.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 | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/CreateSecretStoreInputBody.md b/docs/CreateSecretStoreInputBody.md new file mode 100644 index 0000000..ccc3883 --- /dev/null +++ b/docs/CreateSecretStoreInputBody.md @@ -0,0 +1,25 @@ + + +# CreateSecretStoreInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**apiProvider** | [**ApiProviderEnum**](#ApiProviderEnum) | | | +|**key** | **String** | The provider's API key, encrypted before storage. | | +|**teamId** | **Long** | Registers a team secret when set; the caller must administer that team. Registers a personal secret when omitted. | [optional] | + + + +## Enum: ApiProviderEnum + +| Name | Value | +|---- | -----| +| VIRUS_TOTAL | "virus_total" | +| MALWARE_BAZAAR | "malware_bazaar" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ErrorBody.md b/docs/ErrorBody.md index fc480f1..fa08969 100644 --- a/docs/ErrorBody.md +++ b/docs/ErrorBody.md @@ -51,6 +51,7 @@ | NOT_IMPLEMENTED | "NOT_IMPLEMENTED" | | NO_ACTIVE_RUN | "NO_ACTIVE_RUN" | | NO_PENDING_CONFIRMATION | "NO_PENDING_CONFIRMATION" | +| NO_VIRUSTOTAL_KEY | "NO_VIRUSTOTAL_KEY" | | OIDC_DISCOVERY_FAILED | "OIDC_DISCOVERY_FAILED" | | PASSWORD_RESET_REQUIRED | "PASSWORD_RESET_REQUIRED" | | PAYMENT_REQUIRED | "PAYMENT_REQUIRED" | diff --git a/docs/ExternalSourcesApi.md b/docs/ExternalSourcesApi.md index 6beafb9..8eb03d5 100644 --- a/docs/ExternalSourcesApi.md +++ b/docs/ExternalSourcesApi.md @@ -7,6 +7,8 @@ All URIs are relative to *https://api.reveng.ai* | [**createExternalTaskVt**](ExternalSourcesApi.md#createExternalTaskVt) | **POST** /v2/analysis/{analysis_id}/external/vt | Pulls data from VirusTotal | | [**getVtData**](ExternalSourcesApi.md#getVtData) | **GET** /v2/analysis/{analysis_id}/external/vt | Get VirusTotal data | | [**getVtTaskStatus**](ExternalSourcesApi.md#getVtTaskStatus) | **GET** /v2/analysis/{analysis_id}/external/vt/status | Check the status of VirusTotal data retrieval | +| [**v3GetVirustotalScanOperation**](ExternalSourcesApi.md#v3GetVirustotalScanOperation) | **GET** /v3/operations/virustotal-scan/{binary_id} | Get a VirusTotal scan operation. | +| [**v3RunVirustotalScan**](ExternalSourcesApi.md#v3RunVirustotalScan) | **POST** /v3/binaries/{binary_id}/virustotal-scan:run | Trigger a VirusTotal lookup for a binary. | @@ -227,3 +229,158 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **v3GetVirustotalScanOperation** +> OperationVirusTotalScanMetadataVirusTotalScanResult v3GetVirustotalScanOperation(binaryId) + +Get a VirusTotal scan operation. + +Returns the current state of the most recently triggered VirusTotal lookup for this binary. **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.ExternalSourcesApi; + +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"); + + ExternalSourcesApi apiInstance = new ExternalSourcesApi(defaultClient); + Long binaryId = 56L; // Long | Binary ID + try { + OperationVirusTotalScanMetadataVirusTotalScanResult result = apiInstance.v3GetVirustotalScanOperation(binaryId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ExternalSourcesApi#v3GetVirustotalScanOperation"); + 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 + +[**OperationVirusTotalScanMetadataVirusTotalScanResult**](OperationVirusTotalScanMetadataVirusTotalScanResult.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 | - | + + +# **v3RunVirustotalScan** +> OperationVirusTotalScanMetadataVirusTotalScanResult v3RunVirustotalScan(binaryId) + +Trigger a VirusTotal lookup for a binary. + +Starts a lookup of the binary's content hash against VirusTotal, using the team's registered API key, and returns the operation to poll for its outcome. Returns 403 if the team has no valid key registered, and 409 while a lookup is already in progress for this binary. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `403` [`NO_VIRUSTOTAL_KEY`](/errors/NO_VIRUSTOTAL_KEY) — No VirusTotal Key + +### 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.ExternalSourcesApi; + +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"); + + ExternalSourcesApi apiInstance = new ExternalSourcesApi(defaultClient); + Long binaryId = 56L; // Long | Binary ID + try { + OperationVirusTotalScanMetadataVirusTotalScanResult result = apiInstance.v3RunVirustotalScan(binaryId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ExternalSourcesApi#v3RunVirustotalScan"); + 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 + +[**OperationVirusTotalScanMetadataVirusTotalScanResult**](OperationVirusTotalScanMetadataVirusTotalScanResult.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 | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/FunctionsAiDecompilationApi.md b/docs/FunctionsAiDecompilationApi.md index c94afe7..843ae7c 100644 --- a/docs/FunctionsAiDecompilationApi.md +++ b/docs/FunctionsAiDecompilationApi.md @@ -20,9 +20,11 @@ All URIs are relative to *https://api.reveng.ai* | [**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 | +| [**v3GetAiDecompilationRating**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationRating) | **GET** /v3/functions/{function_id}/ai-decompilation/rating | Get AI decompilation rating | | [**v3GetAiDecompilationTokens**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides | | [**v3GetAiDecompilationTypeSuggestions**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTypeSuggestions) | **GET** /v3/functions/{function_id}/ai-decompilation/type-suggestions | Get AI decompilation type suggestions | | [**v3UpsertAiDecompilationOverrides**](FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides | +| [**v3UpsertAiDecompilationRating**](FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationRating) | **PATCH** /v3/functions/{function_id}/ai-decompilation/rating | Upsert AI decompilation rating | @@ -1263,6 +1265,83 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3GetAiDecompilationRating** +> RatingOutputBody v3GetAiDecompilationRating(functionId) + +Get AI decompilation rating + +Returns the caller's rating and reason for a function's AI decompilation, or null fields when they have not rated it yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `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 + try { + RatingOutputBody result = apiInstance.v3GetAiDecompilationRating(functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3GetAiDecompilationRating"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **functionId** | **Long**| Function ID | | + +### Return type + +[**RatingOutputBody**](RatingOutputBody.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 | - | + # **v3GetAiDecompilationTokens** > GetTokensResponse v3GetAiDecompilationTokens(functionId) @@ -1497,3 +1576,81 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3UpsertAiDecompilationRating** +> v3UpsertAiDecompilationRating(functionId, upsertRatingInputBody) + +Upsert AI decompilation rating + +Records the caller's rating and optional reason for a function's AI decompilation, replacing any they recorded before. Requires an existing decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `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 + UpsertRatingInputBody upsertRatingInputBody = new UpsertRatingInputBody(); // UpsertRatingInputBody | + try { + apiInstance.v3UpsertAiDecompilationRating(functionId, upsertRatingInputBody); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3UpsertAiDecompilationRating"); + 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 | | +| **upsertRatingInputBody** | [**UpsertRatingInputBody**](UpsertRatingInputBody.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/FunctionsCoreApi.md b/docs/FunctionsCoreApi.md index a43af2d..313737e 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 | +| [**v3GetAnalysisFuncMaps**](FunctionsCoreApi.md#v3GetAnalysisFuncMaps) | **GET** /v3/analyses/{analysis_id}/func-maps | Get function ID/address maps for an analysis | | [**v3SearchFunctions**](FunctionsCoreApi.md#v3SearchFunctions) | **GET** /v3/functions | Search functions | @@ -1897,6 +1898,83 @@ public class Example { | **500** | Internal Server Error | - | | **503** | Service Unavailable | - | + +# **v3GetAnalysisFuncMaps** +> GetFunctionMapsOutputBody v3GetAnalysisFuncMaps(analysisId) + +Get function ID/address maps for an analysis + +Returns three maps built from every function in the analysis's binary: function ID to virtual address, its inverse, and virtual address to mangled name. Empty maps for a binary with no functions yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.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); + Long analysisId = 56L; // Long | Analysis ID + try { + GetFunctionMapsOutputBody result = apiInstance.v3GetAnalysisFuncMaps(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsCoreApi#v3GetAnalysisFuncMaps"); + 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 + +[**GetFunctionMapsOutputBody**](GetFunctionMapsOutputBody.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 | - | + # **v3SearchFunctions** > SearchFunctionsOutputBody v3SearchFunctions(partialName, modelName, limit, offset) diff --git a/docs/GetAPIKeysOutputBody.md b/docs/GetAPIKeysOutputBody.md new file mode 100644 index 0000000..e6e47a7 --- /dev/null +++ b/docs/GetAPIKeysOutputBody.md @@ -0,0 +1,13 @@ + + +# GetAPIKeysOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**keys** | **List<ApiKeyBody>** | The caller's active API keys. Currently always exactly one, created on first request if the caller doesn't have one yet | | + + + diff --git a/docs/GetFunctionMapsOutputBody.md b/docs/GetFunctionMapsOutputBody.md new file mode 100644 index 0000000..4c88b99 --- /dev/null +++ b/docs/GetFunctionMapsOutputBody.md @@ -0,0 +1,15 @@ + + +# GetFunctionMapsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**functionMap** | **Map<String, Long>** | Function ID (as a string key) to virtual address, for every function in the analysis's binary. | | +|**inverseFunctionMap** | **Map<String, Long>** | Virtual address (as a string key) to function ID — the inverse of function_map. | | +|**nameMap** | **Map<String, String>** | Virtual address (as a string key) to mangled function name. Empty string for a function with no mangled name. | | + + + diff --git a/docs/GetPublicUserOutputBody.md b/docs/GetPublicUserOutputBody.md new file mode 100644 index 0000000..66651ed --- /dev/null +++ b/docs/GetPublicUserOutputBody.md @@ -0,0 +1,14 @@ + + +# GetPublicUserOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**userId** | **Long** | The user's ID | | +|**username** | **String** | The user's display name | | + + + diff --git a/docs/GetUserActivityOutputBody.md b/docs/GetUserActivityOutputBody.md new file mode 100644 index 0000000..51ecbe4 --- /dev/null +++ b/docs/GetUserActivityOutputBody.md @@ -0,0 +1,13 @@ + + +# GetUserActivityOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**activities** | **List<ActivityBody>** | Recent activity visible to the caller: their own private activity, their team's, and everyone's public activity | | + + + diff --git a/docs/ListSecretStoreOutputBody.md b/docs/ListSecretStoreOutputBody.md new file mode 100644 index 0000000..c8277a8 --- /dev/null +++ b/docs/ListSecretStoreOutputBody.md @@ -0,0 +1,13 @@ + + +# ListSecretStoreOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**secrets** | **List<SecretBody>** | | | + + + diff --git a/docs/OperationVirusTotalScanMetadataVirusTotalScanResult.md b/docs/OperationVirusTotalScanMetadataVirusTotalScanResult.md new file mode 100644 index 0000000..8b5dc1a --- /dev/null +++ b/docs/OperationVirusTotalScanMetadataVirusTotalScanResult.md @@ -0,0 +1,17 @@ + + +# OperationVirusTotalScanMetadataVirusTotalScanResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**done** | **Boolean** | Whether the operation has reached a terminal state. | | +|**error** | **Status** | Failure detail, populated only when done is true and the operation failed. | [optional] | +|**metadata** | **VirusTotalScanMetadata** | In-flight information and details. | [optional] | +|**name** | **String** | API resource name. | | +|**response** | **VirusTotalScanResult** | Result, set only when done is true and the operation succeeded. | [optional] | + + + diff --git a/docs/RatingOutputBody.md b/docs/RatingOutputBody.md new file mode 100644 index 0000000..2033030 --- /dev/null +++ b/docs/RatingOutputBody.md @@ -0,0 +1,25 @@ + + +# RatingOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**rating** | [**RatingEnum**](#RatingEnum) | The rating the caller recorded, or null when they have not rated it yet | | +|**reason** | **String** | The reason the caller gave, or null | | + + + +## Enum: RatingEnum + +| Name | Value | +|---- | -----| +| POSITIVE | "POSITIVE" | +| NEUTRAL | "NEUTRAL" | +| NEGATIVE | "NEGATIVE" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ResendVerificationEmailInputBody.md b/docs/ResendVerificationEmailInputBody.md new file mode 100644 index 0000000..0650d20 --- /dev/null +++ b/docs/ResendVerificationEmailInputBody.md @@ -0,0 +1,13 @@ + + +# ResendVerificationEmailInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**email** | **String** | Email address of the account to resend a verification code to | | + + + diff --git a/docs/SecretBody.md b/docs/SecretBody.md new file mode 100644 index 0000000..67822fe --- /dev/null +++ b/docs/SecretBody.md @@ -0,0 +1,31 @@ + + +# SecretBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**active** | **Boolean** | | | +|**apiProvider** | [**ApiProviderEnum**](#ApiProviderEnum) | | | +|**creation** | **OffsetDateTime** | | | +|**disabledAt** | **OffsetDateTime** | | [optional] | +|**id** | **Long** | | | +|**key** | **String** | Masked API key showing only the last 4 characters | | +|**teamId** | **Long** | Null for a personal secret | [optional] | +|**userId** | **Long** | | | +|**valid** | **Boolean** | | | + + + +## Enum: ApiProviderEnum + +| Name | Value | +|---- | -----| +| VIRUS_TOTAL | "virus_total" | +| MALWARE_BAZAAR | "malware_bazaar" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/Status.md b/docs/Status.md index 7bb874f..f77b1f6 100644 --- a/docs/Status.md +++ b/docs/Status.md @@ -51,6 +51,7 @@ | NOT_IMPLEMENTED | "NOT_IMPLEMENTED" | | NO_ACTIVE_RUN | "NO_ACTIVE_RUN" | | NO_PENDING_CONFIRMATION | "NO_PENDING_CONFIRMATION" | +| NO_VIRUSTOTAL_KEY | "NO_VIRUSTOTAL_KEY" | | OIDC_DISCOVERY_FAILED | "OIDC_DISCOVERY_FAILED" | | PASSWORD_RESET_REQUIRED | "PASSWORD_RESET_REQUIRED" | | PAYMENT_REQUIRED | "PAYMENT_REQUIRED" | diff --git a/docs/SubmitFeedbackBody.md b/docs/SubmitFeedbackBody.md new file mode 100644 index 0000000..6db2888 --- /dev/null +++ b/docs/SubmitFeedbackBody.md @@ -0,0 +1,15 @@ + + +# SubmitFeedbackBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**currentRoute** | **String** | The route the caller was on when they submitted feedback | | +|**feedback** | **String** | The feedback text | | +|**screenCaptureUrl** | **String** | Optional URL to a screen capture related to the feedback | [optional] | + + + diff --git a/docs/SubmitFeedbackOutputBody.md b/docs/SubmitFeedbackOutputBody.md new file mode 100644 index 0000000..12ca7ea --- /dev/null +++ b/docs/SubmitFeedbackOutputBody.md @@ -0,0 +1,13 @@ + + +# SubmitFeedbackOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**message** | **String** | Confirmation message | | + + + diff --git a/docs/UpdateSecretStoreInputBody.md b/docs/UpdateSecretStoreInputBody.md new file mode 100644 index 0000000..cca4388 --- /dev/null +++ b/docs/UpdateSecretStoreInputBody.md @@ -0,0 +1,14 @@ + + +# UpdateSecretStoreInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**active** | **Boolean** | Activates or deactivates the secret. Omit to leave unchanged. | [optional] | +|**key** | **String** | New API key. Omit to leave the current key unchanged. | [optional] | + + + diff --git a/docs/UpsertRatingInputBody.md b/docs/UpsertRatingInputBody.md new file mode 100644 index 0000000..02de584 --- /dev/null +++ b/docs/UpsertRatingInputBody.md @@ -0,0 +1,25 @@ + + +# UpsertRatingInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**rating** | [**RatingEnum**](#RatingEnum) | How useful the caller found this AI decompilation | | +|**reason** | **String** | Optional free-text reason for the rating | [optional] | + + + +## Enum: RatingEnum + +| Name | Value | +|---- | -----| +| POSITIVE | "POSITIVE" | +| NEUTRAL | "NEUTRAL" | +| NEGATIVE | "NEGATIVE" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/VirusTotalScanMetadata.md b/docs/VirusTotalScanMetadata.md new file mode 100644 index 0000000..aa39a39 --- /dev/null +++ b/docs/VirusTotalScanMetadata.md @@ -0,0 +1,26 @@ + + +# VirusTotalScanMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | [**StatusEnum**](#StatusEnum) | Lookup status. UNINITIALISED means this binary has never had a lookup triggered. | | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| UNINITIALISED | "UNINITIALISED" | +| PENDING | "PENDING" | +| RUNNING | "RUNNING" | +| COMPLETED | "COMPLETED" | +| FAILED | "FAILED" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/VirusTotalScanResult.md b/docs/VirusTotalScanResult.md new file mode 100644 index 0000000..0b0c3db --- /dev/null +++ b/docs/VirusTotalScanResult.md @@ -0,0 +1,15 @@ + + +# VirusTotalScanResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sha256Hash** | **String** | Content hash the lookup was keyed by | | +|**vt** | **Object** | | | +|**vtLastUpdated** | **OffsetDateTime** | When this result was recorded | | + + + diff --git a/pom.xml b/pom.xml index c6e4f5b..7c83309 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 4.60.1 + 4.64.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AnalysesCoreApi.java b/src/main/java/ai/reveng/api/AnalysesCoreApi.java index b5ee627..7b350c1 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -50,7 +50,6 @@ import ai.reveng.model.BaseResponseRecent; import ai.reveng.model.BaseResponseStatus; import ai.reveng.model.BaseResponseUploadResponse; -import ai.reveng.model.CreateRequest; import ai.reveng.model.DynamicExecutionStatus; import ai.reveng.model.DynamicExecutionStatusResponse; import java.io.File; @@ -3586,174 +3585,6 @@ public okhttp3.Call uploadFileAsync(@javax.annotation.Nonnull UploadFileType upl localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } - /** - * Build call for v3CreateAnalysis - * @param createRequest (required) - * @param xRevEngApplication Identifies the calling RevEng application. Recorded on the Analysis log. (optional) - * @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
201 Created -
400 Bad Request -
402 Payment Required -
403 Forbidden -
404 Not Found -
409 Conflict -
413 Request Entity Too Large -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call v3CreateAnalysisCall(@javax.annotation.Nonnull CreateRequest createRequest, @javax.annotation.Nullable String xRevEngApplication, 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 = createRequest; - - // create path and map variables - String localVarPath = "/v3/analyses"; - - 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); - } - - if (xRevEngApplication != null) { - localVarHeaderParams.put("X-RevEng-Application", localVarApiClient.parameterToString(xRevEngApplication)); - } - - - 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 v3CreateAnalysisValidateBeforeCall(@javax.annotation.Nonnull CreateRequest createRequest, @javax.annotation.Nullable String xRevEngApplication, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'createRequest' is set - if (createRequest == null) { - throw new ApiException("Missing the required parameter 'createRequest' when calling v3CreateAnalysis(Async)"); - } - - return v3CreateAnalysisCall(createRequest, xRevEngApplication, _callback); - - } - - /** - * Create an analysis - * Queues a new Analysis for an uploaded Binary and returns the created Operation. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `402` [`INSUFFICIENT_CREDITS`](/errors/INSUFFICIENT_CREDITS) — Insufficient Credits - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `413` [`REQUEST_ENTITY_TOO_LARGE`](/errors/REQUEST_ENTITY_TOO_LARGE) — Request Entity Too Large - * @param createRequest (required) - * @param xRevEngApplication Identifies the calling RevEng application. Recorded on the Analysis log. (optional) - * @return OperationCreateMetadataCreateResult - * @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
201 Created -
400 Bad Request -
402 Payment Required -
403 Forbidden -
404 Not Found -
409 Conflict -
413 Request Entity Too Large -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public OperationCreateMetadataCreateResult v3CreateAnalysis(@javax.annotation.Nonnull CreateRequest createRequest, @javax.annotation.Nullable String xRevEngApplication) throws ApiException { - ApiResponse localVarResp = v3CreateAnalysisWithHttpInfo(createRequest, xRevEngApplication); - return localVarResp.getData(); - } - - /** - * Create an analysis - * Queues a new Analysis for an uploaded Binary and returns the created Operation. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `402` [`INSUFFICIENT_CREDITS`](/errors/INSUFFICIENT_CREDITS) — Insufficient Credits - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `413` [`REQUEST_ENTITY_TOO_LARGE`](/errors/REQUEST_ENTITY_TOO_LARGE) — Request Entity Too Large - * @param createRequest (required) - * @param xRevEngApplication Identifies the calling RevEng application. Recorded on the Analysis log. (optional) - * @return ApiResponse<OperationCreateMetadataCreateResult> - * @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
201 Created -
400 Bad Request -
402 Payment Required -
403 Forbidden -
404 Not Found -
409 Conflict -
413 Request Entity Too Large -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public ApiResponse v3CreateAnalysisWithHttpInfo(@javax.annotation.Nonnull CreateRequest createRequest, @javax.annotation.Nullable String xRevEngApplication) throws ApiException { - okhttp3.Call localVarCall = v3CreateAnalysisValidateBeforeCall(createRequest, xRevEngApplication, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Create an analysis (asynchronously) - * Queues a new Analysis for an uploaded Binary and returns the created Operation. **Error codes:** - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `402` [`INSUFFICIENT_CREDITS`](/errors/INSUFFICIENT_CREDITS) — Insufficient Credits - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `413` [`REQUEST_ENTITY_TOO_LARGE`](/errors/REQUEST_ENTITY_TOO_LARGE) — Request Entity Too Large - * @param createRequest (required) - * @param xRevEngApplication Identifies the calling RevEng application. Recorded on the Analysis log. (optional) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - - - - - - -
Response Details
Status Code Description Response Headers
201 Created -
400 Bad Request -
402 Payment Required -
403 Forbidden -
404 Not Found -
409 Conflict -
413 Request Entity Too Large -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call v3CreateAnalysisAsync(@javax.annotation.Nonnull CreateRequest createRequest, @javax.annotation.Nullable String xRevEngApplication, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = v3CreateAnalysisValidateBeforeCall(createRequest, xRevEngApplication, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for v3DeleteAnalysis * @param analysisId Analysis ID (required) diff --git a/src/main/java/ai/reveng/api/AuthenticationUsersApi.java b/src/main/java/ai/reveng/api/AuthenticationUsersApi.java index b996fb8..d9959d9 100644 --- a/src/main/java/ai/reveng/api/AuthenticationUsersApi.java +++ b/src/main/java/ai/reveng/api/AuthenticationUsersApi.java @@ -26,9 +26,14 @@ import java.io.IOException; +import ai.reveng.model.APIError; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseGetPublicUserResponse; import ai.reveng.model.BaseResponseListUserActivityResponse; +import ai.reveng.model.GetPublicUserOutputBody; +import ai.reveng.model.GetUserActivityOutputBody; +import ai.reveng.model.SubmitFeedbackBody; +import ai.reveng.model.SubmitFeedbackOutputBody; import ai.reveng.model.SubmitUserFeedbackRequest; import java.lang.reflect.Type; @@ -457,4 +462,403 @@ public okhttp3.Call submitUserFeedbackAsync(@javax.annotation.Nonnull SubmitUser localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetUser + * @param userId User 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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetUserCall(@javax.annotation.Nonnull Long userId, 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/users/{user_id}" + .replace("{" + "user_id" + "}", localVarApiClient.escapeString(userId.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 v3GetUserValidateBeforeCall(@javax.annotation.Nonnull Long userId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'userId' is set + if (userId == null) { + throw new ApiException("Missing the required parameter 'userId' when calling v3GetUser(Async)"); + } + + return v3GetUserCall(userId, _callback); + + } + + /** + * Get a user's public information + * Returns a user's username. Any authenticated caller may look up any user by ID. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param userId User ID (required) + * @return GetPublicUserOutputBody + * @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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public GetPublicUserOutputBody v3GetUser(@javax.annotation.Nonnull Long userId) throws ApiException { + ApiResponse localVarResp = v3GetUserWithHttpInfo(userId); + return localVarResp.getData(); + } + + /** + * Get a user's public information + * Returns a user's username. Any authenticated caller may look up any user by ID. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param userId User ID (required) + * @return ApiResponse<GetPublicUserOutputBody> + * @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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3GetUserWithHttpInfo(@javax.annotation.Nonnull Long userId) throws ApiException { + okhttp3.Call localVarCall = v3GetUserValidateBeforeCall(userId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a user's public information (asynchronously) + * Returns a user's username. Any authenticated caller may look up any user by ID. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param userId User 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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetUserAsync(@javax.annotation.Nonnull Long userId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetUserValidateBeforeCall(userId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetUserActivity + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public okhttp3.Call v3GetUserActivityCall(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/users/activity"; + + 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 v3GetUserActivityValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return v3GetUserActivityCall(_callback); + + } + + /** + * Get the caller's activity feed + * Returns the caller's own recent activity, their team's, and everyone's public activity, newest first. + * @return GetUserActivityOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public GetUserActivityOutputBody v3GetUserActivity() throws ApiException { + ApiResponse localVarResp = v3GetUserActivityWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Get the caller's activity feed + * Returns the caller's own recent activity, their team's, and everyone's public activity, newest first. + * @return ApiResponse<GetUserActivityOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public ApiResponse v3GetUserActivityWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = v3GetUserActivityValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the caller's activity feed (asynchronously) + * Returns the caller's own recent activity, their team's, and everyone's public activity, newest first. + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
0 Error -
+ */ + public okhttp3.Call v3GetUserActivityAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetUserActivityValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3SubmitUserFeedback + * @param submitFeedbackBody (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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SubmitUserFeedbackCall(@javax.annotation.Nonnull SubmitFeedbackBody submitFeedbackBody, 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 = submitFeedbackBody; + + // create path and map variables + String localVarPath = "/v3/users/feedback"; + + 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 v3SubmitUserFeedbackValidateBeforeCall(@javax.annotation.Nonnull SubmitFeedbackBody submitFeedbackBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'submitFeedbackBody' is set + if (submitFeedbackBody == null) { + throw new ApiException("Missing the required parameter 'submitFeedbackBody' when calling v3SubmitUserFeedback(Async)"); + } + + return v3SubmitUserFeedbackCall(submitFeedbackBody, _callback); + + } + + /** + * Submit feedback + * Submits feedback about the application to a Slack channel. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param submitFeedbackBody (required) + * @return SubmitFeedbackOutputBody + * @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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public SubmitFeedbackOutputBody v3SubmitUserFeedback(@javax.annotation.Nonnull SubmitFeedbackBody submitFeedbackBody) throws ApiException { + ApiResponse localVarResp = v3SubmitUserFeedbackWithHttpInfo(submitFeedbackBody); + return localVarResp.getData(); + } + + /** + * Submit feedback + * Submits feedback about the application to a Slack channel. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param submitFeedbackBody (required) + * @return ApiResponse<SubmitFeedbackOutputBody> + * @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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3SubmitUserFeedbackWithHttpInfo(@javax.annotation.Nonnull SubmitFeedbackBody submitFeedbackBody) throws ApiException { + okhttp3.Call localVarCall = v3SubmitUserFeedbackValidateBeforeCall(submitFeedbackBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Submit feedback (asynchronously) + * Submits feedback about the application to a Slack channel. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param submitFeedbackBody (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 -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3SubmitUserFeedbackAsync(@javax.annotation.Nonnull SubmitFeedbackBody submitFeedbackBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3SubmitUserFeedbackValidateBeforeCall(submitFeedbackBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/api/ExternalSourcesApi.java b/src/main/java/ai/reveng/api/ExternalSourcesApi.java index 475633f..b23b9e5 100644 --- a/src/main/java/ai/reveng/api/ExternalSourcesApi.java +++ b/src/main/java/ai/reveng/api/ExternalSourcesApi.java @@ -26,10 +26,12 @@ import java.io.IOException; +import ai.reveng.model.APIError; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseExternalResponse; import ai.reveng.model.BaseResponseStr; import ai.reveng.model.BaseResponseTaskResponse; +import ai.reveng.model.OperationVirusTotalScanMetadataVirusTotalScanResult; import java.lang.reflect.Type; import java.util.ArrayList; @@ -475,4 +477,294 @@ public okhttp3.Call getVtTaskStatusAsync(@javax.annotation.Nonnull Integer analy localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetVirustotalScanOperation + * @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 v3GetVirustotalScanOperationCall(@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/operations/virustotal-scan/{binary_id}" + .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 v3GetVirustotalScanOperationValidateBeforeCall(@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 v3GetVirustotalScanOperation(Async)"); + } + + return v3GetVirustotalScanOperationCall(binaryId, _callback); + + } + + /** + * Get a VirusTotal scan operation. + * Returns the current state of the most recently triggered VirusTotal lookup for this binary. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param binaryId Binary ID (required) + * @return OperationVirusTotalScanMetadataVirusTotalScanResult + * @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 OperationVirusTotalScanMetadataVirusTotalScanResult v3GetVirustotalScanOperation(@javax.annotation.Nonnull Long binaryId) throws ApiException { + ApiResponse localVarResp = v3GetVirustotalScanOperationWithHttpInfo(binaryId); + return localVarResp.getData(); + } + + /** + * Get a VirusTotal scan operation. + * Returns the current state of the most recently triggered VirusTotal lookup for this binary. **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<OperationVirusTotalScanMetadataVirusTotalScanResult> + * @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 v3GetVirustotalScanOperationWithHttpInfo(@javax.annotation.Nonnull Long binaryId) throws ApiException { + okhttp3.Call localVarCall = v3GetVirustotalScanOperationValidateBeforeCall(binaryId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a VirusTotal scan operation. (asynchronously) + * Returns the current state of the most recently triggered VirusTotal lookup for this binary. **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 v3GetVirustotalScanOperationAsync(@javax.annotation.Nonnull Long binaryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetVirustotalScanOperationValidateBeforeCall(binaryId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3RunVirustotalScan + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RunVirustotalScanCall(@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}/virustotal-scan:run" + .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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3RunVirustotalScanValidateBeforeCall(@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 v3RunVirustotalScan(Async)"); + } + + return v3RunVirustotalScanCall(binaryId, _callback); + + } + + /** + * Trigger a VirusTotal lookup for a binary. + * Starts a lookup of the binary's content hash against VirusTotal, using the team's registered API key, and returns the operation to poll for its outcome. Returns 403 if the team has no valid key registered, and 409 while a lookup is already in progress for this binary. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `403` [`NO_VIRUSTOTAL_KEY`](/errors/NO_VIRUSTOTAL_KEY) — No VirusTotal Key + * @param binaryId Binary ID (required) + * @return OperationVirusTotalScanMetadataVirusTotalScanResult + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public OperationVirusTotalScanMetadataVirusTotalScanResult v3RunVirustotalScan(@javax.annotation.Nonnull Long binaryId) throws ApiException { + ApiResponse localVarResp = v3RunVirustotalScanWithHttpInfo(binaryId); + return localVarResp.getData(); + } + + /** + * Trigger a VirusTotal lookup for a binary. + * Starts a lookup of the binary's content hash against VirusTotal, using the team's registered API key, and returns the operation to poll for its outcome. Returns 403 if the team has no valid key registered, and 409 while a lookup is already in progress for this binary. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `403` [`NO_VIRUSTOTAL_KEY`](/errors/NO_VIRUSTOTAL_KEY) — No VirusTotal Key + * @param binaryId Binary ID (required) + * @return ApiResponse<OperationVirusTotalScanMetadataVirusTotalScanResult> + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3RunVirustotalScanWithHttpInfo(@javax.annotation.Nonnull Long binaryId) throws ApiException { + okhttp3.Call localVarCall = v3RunVirustotalScanValidateBeforeCall(binaryId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Trigger a VirusTotal lookup for a binary. (asynchronously) + * Starts a lookup of the binary's content hash against VirusTotal, using the team's registered API key, and returns the operation to poll for its outcome. Returns 403 if the team has no valid key registered, and 409 while a lookup is already in progress for this binary. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `403` [`NO_VIRUSTOTAL_KEY`](/errors/NO_VIRUSTOTAL_KEY) — No VirusTotal Key + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3RunVirustotalScanAsync(@javax.annotation.Nonnull Long binaryId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3RunVirustotalScanValidateBeforeCall(binaryId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java index c5f492b..04923e1 100644 --- a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java +++ b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java @@ -37,6 +37,7 @@ import ai.reveng.model.GetTokensResponse; import ai.reveng.model.LineAttributionsData; import ai.reveng.model.PatchCommentBody; +import ai.reveng.model.RatingOutputBody; import ai.reveng.model.RegenerateOutputBody; import ai.reveng.model.ServerSentEventsInner1; import ai.reveng.model.SummaryData; @@ -44,6 +45,7 @@ import ai.reveng.model.UpsertAiDecomplationRatingRequest; import ai.reveng.model.UpsertOverridesData; import ai.reveng.model.UpsertOverridesInputBody; +import ai.reveng.model.UpsertRatingInputBody; import ai.reveng.model.WorkflowProgress; import java.lang.reflect.Type; @@ -2426,6 +2428,149 @@ public okhttp3.Call v3GetAiDecompilationLineAttributionsAsync(@javax.annotation. localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetAiDecompilationRating + * @param functionId Function ID (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetAiDecompilationRatingCall(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/rating" + .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3GetAiDecompilationRatingValidateBeforeCall(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException("Missing the required parameter 'functionId' when calling v3GetAiDecompilationRating(Async)"); + } + + return v3GetAiDecompilationRatingCall(functionId, _callback); + + } + + /** + * Get AI decompilation rating + * Returns the caller's rating and reason for a function's AI decompilation, or null fields when they have not rated it yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @return RatingOutputBody + * @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 RatingOutputBody v3GetAiDecompilationRating(@javax.annotation.Nonnull Long functionId) throws ApiException { + ApiResponse localVarResp = v3GetAiDecompilationRatingWithHttpInfo(functionId); + return localVarResp.getData(); + } + + /** + * Get AI decompilation rating + * Returns the caller's rating and reason for a function's AI decompilation, or null fields when they have not rated it yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @return ApiResponse<RatingOutputBody> + * @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 v3GetAiDecompilationRatingWithHttpInfo(@javax.annotation.Nonnull Long functionId) throws ApiException { + okhttp3.Call localVarCall = v3GetAiDecompilationRatingValidateBeforeCall(functionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get AI decompilation rating (asynchronously) + * Returns the caller's rating and reason for a function's AI decompilation, or null fields when they have not rated it yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetAiDecompilationRatingAsync(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAiDecompilationRatingValidateBeforeCall(functionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3GetAiDecompilationTokens * @param functionId Function ID (required) @@ -2869,4 +3014,153 @@ public okhttp3.Call v3UpsertAiDecompilationOverridesAsync(@javax.annotation.Nonn localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3UpsertAiDecompilationRating + * @param functionId Function ID (required) + * @param upsertRatingInputBody (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpsertAiDecompilationRatingCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertRatingInputBody upsertRatingInputBody, 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 = upsertRatingInputBody; + + // create path and map variables + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/rating" + .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, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3UpsertAiDecompilationRatingValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertRatingInputBody upsertRatingInputBody, 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 v3UpsertAiDecompilationRating(Async)"); + } + + // verify the required parameter 'upsertRatingInputBody' is set + if (upsertRatingInputBody == null) { + throw new ApiException("Missing the required parameter 'upsertRatingInputBody' when calling v3UpsertAiDecompilationRating(Async)"); + } + + return v3UpsertAiDecompilationRatingCall(functionId, upsertRatingInputBody, _callback); + + } + + /** + * Upsert AI decompilation rating + * Records the caller's rating and optional reason for a function's AI decompilation, replacing any they recorded before. Requires an existing decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param upsertRatingInputBody (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public void v3UpsertAiDecompilationRating(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertRatingInputBody upsertRatingInputBody) throws ApiException { + v3UpsertAiDecompilationRatingWithHttpInfo(functionId, upsertRatingInputBody); + } + + /** + * Upsert AI decompilation rating + * Records the caller's rating and optional reason for a function's AI decompilation, replacing any they recorded before. Requires an existing decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param upsertRatingInputBody (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3UpsertAiDecompilationRatingWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertRatingInputBody upsertRatingInputBody) throws ApiException { + okhttp3.Call localVarCall = v3UpsertAiDecompilationRatingValidateBeforeCall(functionId, upsertRatingInputBody, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Upsert AI decompilation rating (asynchronously) + * Records the caller's rating and optional reason for a function's AI decompilation, replacing any they recorded before. Requires an existing decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param upsertRatingInputBody (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpsertAiDecompilationRatingAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertRatingInputBody upsertRatingInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3UpsertAiDecompilationRatingValidateBeforeCall(functionId, upsertRatingInputBody, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/api/FunctionsCoreApi.java b/src/main/java/ai/reveng/api/FunctionsCoreApi.java index 0b6117c..353b539 100644 --- a/src/main/java/ai/reveng/api/FunctionsCoreApi.java +++ b/src/main/java/ai/reveng/api/FunctionsCoreApi.java @@ -44,6 +44,7 @@ import ai.reveng.model.CapabilitiesOutputBody; import ai.reveng.model.DisassemblyOutputBody; import ai.reveng.model.FunctionDetailsOutputBody; +import ai.reveng.model.GetFunctionMapsOutputBody; import ai.reveng.model.GetMatchesOutputBody; import ai.reveng.model.GetMatchesStatusOutputBody; import ai.reveng.model.ImportedFunctionDetailOutputBody; @@ -3714,6 +3715,149 @@ public okhttp3.Call v3CanonicalizeFunctionNamesAsync(@javax.annotation.Nonnull C localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetAnalysisFuncMaps + * @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 v3GetAnalysisFuncMapsCall(@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}/func-maps" + .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 v3GetAnalysisFuncMapsValidateBeforeCall(@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 v3GetAnalysisFuncMaps(Async)"); + } + + return v3GetAnalysisFuncMapsCall(analysisId, _callback); + + } + + /** + * Get function ID/address maps for an analysis + * Returns three maps built from every function in the analysis's binary: function ID to virtual address, its inverse, and virtual address to mangled name. Empty maps for a binary with no functions yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @return GetFunctionMapsOutputBody + * @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 GetFunctionMapsOutputBody v3GetAnalysisFuncMaps(@javax.annotation.Nonnull Long analysisId) throws ApiException { + ApiResponse localVarResp = v3GetAnalysisFuncMapsWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get function ID/address maps for an analysis + * Returns three maps built from every function in the analysis's binary: function ID to virtual address, its inverse, and virtual address to mangled name. Empty maps for a binary with no functions yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @return ApiResponse<GetFunctionMapsOutputBody> + * @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 v3GetAnalysisFuncMapsWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3GetAnalysisFuncMapsValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get function ID/address maps for an analysis (asynchronously) + * Returns three maps built from every function in the analysis's binary: function ID to virtual address, its inverse, and virtual address to mangled name. Empty maps for a binary with no functions yet. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @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 v3GetAnalysisFuncMapsAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAnalysisFuncMapsValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3SearchFunctions * @param partialName Partial or full function name to search for (optional) diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 383cb5e..2c9b11f 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.60.1/java"); + setUserAgent("OpenAPI-Generator/4.64.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/ai/reveng/invoker/Configuration.java b/src/main/java/ai/reveng/invoker/Configuration.java index c12aa5b..5816783 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.60.1"; + public static final String VERSION = "4.64.0"; private static final AtomicReference defaultApiClient = new AtomicReference<>(); private static volatile Supplier apiClientFactory = ApiClient::new; diff --git a/src/main/java/ai/reveng/invoker/JSON.java b/src/main/java/ai/reveng/invoker/JSON.java index 34745bc..6b4e346 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -178,6 +178,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri 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.ActivityBody.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()); @@ -229,6 +230,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri 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.ApiKeyBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2AgentSchemaCapability.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsResponsesFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsTypesFunction.CustomTypeAdapterFactory()); @@ -402,6 +404,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreatePortalSessionInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateSecretStoreInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateStructDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateTeamInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateTypedefDataType.CustomTypeAdapterFactory()); @@ -544,6 +547,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionsListRename.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionsProgressOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GeneratePDFOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAPIKeysOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAdditionalDetailsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAdditionalDetailsStatusOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAiDecompilationRatingResponse.CustomTypeAdapterFactory()); @@ -554,16 +558,19 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetConfigOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetDataTypeHistoryBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetDieInfoOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetFunctionMapsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetFunctionSignatureHistoryBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetMatchesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetMatchesStatusOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetModelsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetProductsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetPublicUserOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetPublicUserResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetRelatedBinariesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetRelatedStatusOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetSubscriptionOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetTokensResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetUserActivityOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.HardcodedSecretEvidence.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.HistoryActor.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.HistoryEntry.CustomTypeAdapterFactory()); @@ -599,6 +606,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionSignaturesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionStringsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListImportedFunctionsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListSecretStoreOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListTeamsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListUsersOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.LocationOutputBody.CustomTypeAdapterFactory()); @@ -647,6 +655,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationNetworkingExplainMetadataNetworkingExplainResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationNetworkingScanMetadataNetworkingScanResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationSecurityScanMetadataSecurityScanResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationVirusTotalScanMetadataVirusTotalScanResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OperationWorkflowProgressResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Organisation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.OrganisationGroup.CustomTypeAdapterFactory()); @@ -681,6 +690,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProtocolsAgentResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PutAnalysisStringsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.QueuedWorkflowTaskResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RatingOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReAnalysisForm.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Recent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReferencedConstant.CustomTypeAdapterFactory()); @@ -706,6 +716,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportOptions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RequestedConfigBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ResendVerificationEmailInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ResolvedEntity.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ResultBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RevokeBody.CustomTypeAdapterFactory()); @@ -720,6 +731,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri 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.SecretBody.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()); @@ -779,7 +791,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubjectAnyOf1.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubjectAnyOf2.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubjectAnyOf3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubmitFeedbackBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubmitFeedbackInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubmitFeedbackOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubmitUserFeedbackRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SuggestedHole.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SuggestedMemberView.CustomTypeAdapterFactory()); @@ -840,6 +854,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdatePasswordInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdatePointerDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateProfileInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateSecretStoreInputBody.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()); @@ -855,11 +870,14 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpsertAiDecomplationRatingRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpsertOverridesData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpsertOverridesInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpsertRatingInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.User.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserActivityResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserCredits.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserIdentity.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UserProfile.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.VirusTotalScanMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.VirusTotalScanResult.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()); diff --git a/src/main/java/ai/reveng/model/ActivityBody.java b/src/main/java/ai/reveng/model/ActivityBody.java new file mode 100644 index 0000000..bd94738 --- /dev/null +++ b/src/main/java/ai/reveng/model/ActivityBody.java @@ -0,0 +1,628 @@ +/* + * 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; + +/** + * ActivityBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ActivityBody { + /** + * The kind of action taken + */ + @JsonAdapter(ActionsEnum.Adapter.class) + public enum ActionsEnum { + UPLOADED("UPLOADED"), + + COMPLETED("COMPLETED"), + + CREATED("CREATED"), + + REGISTERED("REGISTERED"), + + REPUTATION("REPUTATION"), + + LEADERBOARD("LEADERBOARD"), + + EDITED("EDITED"), + + DELETED("DELETED"), + + ERROR("ERROR"), + + RENAME("RENAME"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ActionsEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionsEnum fromValue(String value) { + for (ActionsEnum b : ActionsEnum.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 ActionsEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActionsEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionsEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ActionsEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ACTIONS = "actions"; + @SerializedName(SERIALIZED_NAME_ACTIONS) + @javax.annotation.Nonnull + private ActionsEnum actions; + + /** + * Who can see this activity entry + */ + @JsonAdapter(ActivityScopeEnum.Adapter.class) + public enum ActivityScopeEnum { + PUBLIC("PUBLIC"), + + PRIVATE("PRIVATE"), + + TEAM("TEAM"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ActivityScopeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActivityScopeEnum fromValue(String value) { + for (ActivityScopeEnum b : ActivityScopeEnum.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 ActivityScopeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ActivityScopeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActivityScopeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ActivityScopeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_ACTIVITY_SCOPE = "activity_scope"; + @SerializedName(SERIALIZED_NAME_ACTIVITY_SCOPE) + @javax.annotation.Nonnull + private ActivityScopeEnum activityScope; + + 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_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + /** + * The resource kind the action applied to + */ + @JsonAdapter(SourcesEnum.Adapter.class) + public enum SourcesEnum { + USERS("USERS"), + + ANALYSES("ANALYSES"), + + MATCHES("MATCHES"), + + COLLECTIONS("COLLECTIONS"), + + HISTORY("HISTORY"), + + FILES("FILES"), + + FUNCTION("FUNCTION"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourcesEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourcesEnum fromValue(String value) { + for (SourcesEnum b : SourcesEnum.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 SourcesEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourcesEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourcesEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourcesEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCES = "sources"; + @SerializedName(SERIALIZED_NAME_SOURCES) + @javax.annotation.Nonnull + private SourcesEnum sources; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nonnull + private String username; + + public ActivityBody() { + } + + public ActivityBody actions(@javax.annotation.Nonnull ActionsEnum actions) { + this.actions = actions; + return this; + } + + /** + * The kind of action taken + * @return actions + */ + @javax.annotation.Nonnull + public ActionsEnum getActions() { + return actions; + } + + public void setActions(@javax.annotation.Nonnull ActionsEnum actions) { + this.actions = actions; + } + + + public ActivityBody activityScope(@javax.annotation.Nonnull ActivityScopeEnum activityScope) { + this.activityScope = activityScope; + return this; + } + + /** + * Who can see this activity entry + * @return activityScope + */ + @javax.annotation.Nonnull + public ActivityScopeEnum getActivityScope() { + return activityScope; + } + + public void setActivityScope(@javax.annotation.Nonnull ActivityScopeEnum activityScope) { + this.activityScope = activityScope; + } + + + public ActivityBody createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When the action happened + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ActivityBody message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Human-readable description of the action + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + + public ActivityBody sources(@javax.annotation.Nonnull SourcesEnum sources) { + this.sources = sources; + return this; + } + + /** + * The resource kind the action applied to + * @return sources + */ + @javax.annotation.Nonnull + public SourcesEnum getSources() { + return sources; + } + + public void setSources(@javax.annotation.Nonnull SourcesEnum sources) { + this.sources = sources; + } + + + public ActivityBody username(@javax.annotation.Nonnull String username) { + this.username = username; + return this; + } + + /** + * The user who performed the action + * @return username + */ + @javax.annotation.Nonnull + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nonnull String username) { + this.username = username; + } + + /** + * 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 ActivityBody instance itself + */ + public ActivityBody 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; + } + ActivityBody activityBody = (ActivityBody) o; + return Objects.equals(this.actions, activityBody.actions) && + Objects.equals(this.activityScope, activityBody.activityScope) && + Objects.equals(this.createdAt, activityBody.createdAt) && + Objects.equals(this.message, activityBody.message) && + Objects.equals(this.sources, activityBody.sources) && + Objects.equals(this.username, activityBody.username)&& + Objects.equals(this.additionalProperties, activityBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(actions, activityScope, createdAt, message, sources, username, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ActivityBody {\n"); + sb.append(" actions: ").append(toIndentedString(actions)).append("\n"); + sb.append(" activityScope: ").append(toIndentedString(activityScope)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" sources: ").append(toIndentedString(sources)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).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("actions", "activity_scope", "created_at", "message", "sources", "username")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("actions", "activity_scope", "created_at", "message", "sources", "username")); + } + + /** + * 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 ActivityBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ActivityBody.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 ActivityBody is not found in the empty JSON string", ActivityBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ActivityBody.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("actions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `actions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actions").toString())); + } + // validate the required field `actions` + ActionsEnum.validateJsonElement(jsonObj.get("actions")); + if (!jsonObj.get("activity_scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `activity_scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("activity_scope").toString())); + } + // validate the required field `activity_scope` + ActivityScopeEnum.validateJsonElement(jsonObj.get("activity_scope")); + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if (!jsonObj.get("sources").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `sources` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sources").toString())); + } + // validate the required field `sources` + SourcesEnum.validateJsonElement(jsonObj.get("sources")); + if (!jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ActivityBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ActivityBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ActivityBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ActivityBody 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 ActivityBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ActivityBody 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 ActivityBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ActivityBody + * @throws IOException if the JSON string is invalid with respect to ActivityBody + */ + public static ActivityBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ActivityBody.class); + } + + /** + * Convert an instance of ActivityBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ApiKeyBody.java b/src/main/java/ai/reveng/model/ApiKeyBody.java new file mode 100644 index 0000000..253cefa --- /dev/null +++ b/src/main/java/ai/reveng/model/ApiKeyBody.java @@ -0,0 +1,289 @@ +/* + * 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; + +/** + * ApiKeyBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ApiKeyBody { + public static final String SERIALIZED_NAME_API_KEY = "api_key"; + @SerializedName(SERIALIZED_NAME_API_KEY) + @javax.annotation.Nonnull + private String apiKey; + + public ApiKeyBody() { + } + + public ApiKeyBody apiKey(@javax.annotation.Nonnull String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The API key + * @return apiKey + */ + @javax.annotation.Nonnull + public String getApiKey() { + return apiKey; + } + + public void setApiKey(@javax.annotation.Nonnull String apiKey) { + this.apiKey = apiKey; + } + + /** + * 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 ApiKeyBody instance itself + */ + public ApiKeyBody 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; + } + ApiKeyBody apiKeyBody = (ApiKeyBody) o; + return Objects.equals(this.apiKey, apiKeyBody.apiKey)&& + Objects.equals(this.additionalProperties, apiKeyBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ApiKeyBody {\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).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("api_key")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("api_key")); + } + + /** + * 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 ApiKeyBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ApiKeyBody.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 ApiKeyBody is not found in the empty JSON string", ApiKeyBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ApiKeyBody.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("api_key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `api_key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("api_key").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ApiKeyBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ApiKeyBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ApiKeyBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ApiKeyBody 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 ApiKeyBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ApiKeyBody 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 ApiKeyBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ApiKeyBody + * @throws IOException if the JSON string is invalid with respect to ApiKeyBody + */ + public static ApiKeyBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ApiKeyBody.class); + } + + /** + * Convert an instance of ApiKeyBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateSecretStoreInputBody.java b/src/main/java/ai/reveng/model/CreateSecretStoreInputBody.java new file mode 100644 index 0000000..9a01449 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateSecretStoreInputBody.java @@ -0,0 +1,400 @@ +/* + * 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; + +/** + * CreateSecretStoreInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateSecretStoreInputBody { + /** + * Gets or Sets apiProvider + */ + @JsonAdapter(ApiProviderEnum.Adapter.class) + public enum ApiProviderEnum { + VIRUS_TOTAL("virus_total"), + + MALWARE_BAZAAR("malware_bazaar"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ApiProviderEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ApiProviderEnum fromValue(String value) { + for (ApiProviderEnum b : ApiProviderEnum.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 ApiProviderEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ApiProviderEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ApiProviderEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ApiProviderEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_API_PROVIDER = "api_provider"; + @SerializedName(SERIALIZED_NAME_API_PROVIDER) + @javax.annotation.Nonnull + private ApiProviderEnum apiProvider; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nonnull + private String key; + + public static final String SERIALIZED_NAME_TEAM_ID = "team_id"; + @SerializedName(SERIALIZED_NAME_TEAM_ID) + @javax.annotation.Nullable + private Long teamId; + + public CreateSecretStoreInputBody() { + } + + public CreateSecretStoreInputBody apiProvider(@javax.annotation.Nonnull ApiProviderEnum apiProvider) { + this.apiProvider = apiProvider; + return this; + } + + /** + * Get apiProvider + * @return apiProvider + */ + @javax.annotation.Nonnull + public ApiProviderEnum getApiProvider() { + return apiProvider; + } + + public void setApiProvider(@javax.annotation.Nonnull ApiProviderEnum apiProvider) { + this.apiProvider = apiProvider; + } + + + public CreateSecretStoreInputBody key(@javax.annotation.Nonnull String key) { + this.key = key; + return this; + } + + /** + * The provider's API key, encrypted before storage. + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(@javax.annotation.Nonnull String key) { + this.key = key; + } + + + public CreateSecretStoreInputBody teamId(@javax.annotation.Nullable Long teamId) { + this.teamId = teamId; + return this; + } + + /** + * Registers a team secret when set; the caller must administer that team. Registers a personal secret when omitted. + * @return teamId + */ + @javax.annotation.Nullable + public Long getTeamId() { + return teamId; + } + + public void setTeamId(@javax.annotation.Nullable Long teamId) { + this.teamId = teamId; + } + + /** + * 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 CreateSecretStoreInputBody instance itself + */ + public CreateSecretStoreInputBody 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; + } + CreateSecretStoreInputBody createSecretStoreInputBody = (CreateSecretStoreInputBody) o; + return Objects.equals(this.apiProvider, createSecretStoreInputBody.apiProvider) && + Objects.equals(this.key, createSecretStoreInputBody.key) && + Objects.equals(this.teamId, createSecretStoreInputBody.teamId)&& + Objects.equals(this.additionalProperties, createSecretStoreInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(apiProvider, key, teamId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSecretStoreInputBody {\n"); + sb.append(" apiProvider: ").append(toIndentedString(apiProvider)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" teamId: ").append(toIndentedString(teamId)).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("api_provider", "key", "team_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("api_provider", "key")); + } + + /** + * 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 CreateSecretStoreInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSecretStoreInputBody.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 CreateSecretStoreInputBody is not found in the empty JSON string", CreateSecretStoreInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSecretStoreInputBody.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("api_provider").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `api_provider` to be a primitive type in the JSON string but got `%s`", jsonObj.get("api_provider").toString())); + } + // validate the required field `api_provider` + ApiProviderEnum.validateJsonElement(jsonObj.get("api_provider")); + 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 (!CreateSecretStoreInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSecretStoreInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSecretStoreInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSecretStoreInputBody 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 CreateSecretStoreInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSecretStoreInputBody 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 CreateSecretStoreInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSecretStoreInputBody + * @throws IOException if the JSON string is invalid with respect to CreateSecretStoreInputBody + */ + public static CreateSecretStoreInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSecretStoreInputBody.class); + } + + /** + * Convert an instance of CreateSecretStoreInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ErrorBody.java b/src/main/java/ai/reveng/model/ErrorBody.java index 16cc599..c15523c 100644 --- a/src/main/java/ai/reveng/model/ErrorBody.java +++ b/src/main/java/ai/reveng/model/ErrorBody.java @@ -118,6 +118,8 @@ public enum CodeEnum { NO_PENDING_CONFIRMATION("NO_PENDING_CONFIRMATION"), + NO_VIRUSTOTAL_KEY("NO_VIRUSTOTAL_KEY"), + OIDC_DISCOVERY_FAILED("OIDC_DISCOVERY_FAILED"), PASSWORD_RESET_REQUIRED("PASSWORD_RESET_REQUIRED"), diff --git a/src/main/java/ai/reveng/model/GetAPIKeysOutputBody.java b/src/main/java/ai/reveng/model/GetAPIKeysOutputBody.java new file mode 100644 index 0000000..dc10488 --- /dev/null +++ b/src/main/java/ai/reveng/model/GetAPIKeysOutputBody.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.ApiKeyBody; +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; + +/** + * GetAPIKeysOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetAPIKeysOutputBody { + public static final String SERIALIZED_NAME_KEYS = "keys"; + @SerializedName(SERIALIZED_NAME_KEYS) + @javax.annotation.Nullable + private List keys; + + public GetAPIKeysOutputBody() { + } + + public GetAPIKeysOutputBody keys(@javax.annotation.Nullable List keys) { + this.keys = keys; + return this; + } + + public GetAPIKeysOutputBody addKeysItem(ApiKeyBody keysItem) { + if (this.keys == null) { + this.keys = new ArrayList<>(); + } + this.keys.add(keysItem); + return this; + } + + /** + * The caller's active API keys. Currently always exactly one, created on first request if the caller doesn't have one yet + * @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 GetAPIKeysOutputBody instance itself + */ + public GetAPIKeysOutputBody 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; + } + GetAPIKeysOutputBody getAPIKeysOutputBody = (GetAPIKeysOutputBody) o; + return Objects.equals(this.keys, getAPIKeysOutputBody.keys)&& + Objects.equals(this.additionalProperties, getAPIKeysOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(keys, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetAPIKeysOutputBody {\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 GetAPIKeysOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetAPIKeysOutputBody.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 GetAPIKeysOutputBody is not found in the empty JSON string", GetAPIKeysOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetAPIKeysOutputBody.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 (!GetAPIKeysOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAPIKeysOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetAPIKeysOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetAPIKeysOutputBody 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 GetAPIKeysOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetAPIKeysOutputBody 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 GetAPIKeysOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetAPIKeysOutputBody + * @throws IOException if the JSON string is invalid with respect to GetAPIKeysOutputBody + */ + public static GetAPIKeysOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAPIKeysOutputBody.class); + } + + /** + * Convert an instance of GetAPIKeysOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GetFunctionMapsOutputBody.java b/src/main/java/ai/reveng/model/GetFunctionMapsOutputBody.java new file mode 100644 index 0000000..7ffc4ca --- /dev/null +++ b/src/main/java/ai/reveng/model/GetFunctionMapsOutputBody.java @@ -0,0 +1,364 @@ +/* + * 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 java.util.HashMap; +import java.util.Map; + +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; + +/** + * GetFunctionMapsOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetFunctionMapsOutputBody { + public static final String SERIALIZED_NAME_FUNCTION_MAP = "function_map"; + @SerializedName(SERIALIZED_NAME_FUNCTION_MAP) + @javax.annotation.Nonnull + private Map functionMap = new HashMap<>(); + + public static final String SERIALIZED_NAME_INVERSE_FUNCTION_MAP = "inverse_function_map"; + @SerializedName(SERIALIZED_NAME_INVERSE_FUNCTION_MAP) + @javax.annotation.Nonnull + private Map inverseFunctionMap = new HashMap<>(); + + public static final String SERIALIZED_NAME_NAME_MAP = "name_map"; + @SerializedName(SERIALIZED_NAME_NAME_MAP) + @javax.annotation.Nonnull + private Map nameMap = new HashMap<>(); + + public GetFunctionMapsOutputBody() { + } + + public GetFunctionMapsOutputBody functionMap(@javax.annotation.Nonnull Map functionMap) { + this.functionMap = functionMap; + return this; + } + + public GetFunctionMapsOutputBody putFunctionMapItem(String key, Long functionMapItem) { + if (this.functionMap == null) { + this.functionMap = new HashMap<>(); + } + this.functionMap.put(key, functionMapItem); + return this; + } + + /** + * Function ID (as a string key) to virtual address, for every function in the analysis's binary. + * @return functionMap + */ + @javax.annotation.Nonnull + public Map getFunctionMap() { + return functionMap; + } + + public void setFunctionMap(@javax.annotation.Nonnull Map functionMap) { + this.functionMap = functionMap; + } + + + public GetFunctionMapsOutputBody inverseFunctionMap(@javax.annotation.Nonnull Map inverseFunctionMap) { + this.inverseFunctionMap = inverseFunctionMap; + return this; + } + + public GetFunctionMapsOutputBody putInverseFunctionMapItem(String key, Long inverseFunctionMapItem) { + if (this.inverseFunctionMap == null) { + this.inverseFunctionMap = new HashMap<>(); + } + this.inverseFunctionMap.put(key, inverseFunctionMapItem); + return this; + } + + /** + * Virtual address (as a string key) to function ID — the inverse of function_map. + * @return inverseFunctionMap + */ + @javax.annotation.Nonnull + public Map getInverseFunctionMap() { + return inverseFunctionMap; + } + + public void setInverseFunctionMap(@javax.annotation.Nonnull Map inverseFunctionMap) { + this.inverseFunctionMap = inverseFunctionMap; + } + + + public GetFunctionMapsOutputBody nameMap(@javax.annotation.Nonnull Map nameMap) { + this.nameMap = nameMap; + return this; + } + + public GetFunctionMapsOutputBody putNameMapItem(String key, String nameMapItem) { + if (this.nameMap == null) { + this.nameMap = new HashMap<>(); + } + this.nameMap.put(key, nameMapItem); + return this; + } + + /** + * Virtual address (as a string key) to mangled function name. Empty string for a function with no mangled name. + * @return nameMap + */ + @javax.annotation.Nonnull + public Map getNameMap() { + return nameMap; + } + + public void setNameMap(@javax.annotation.Nonnull Map nameMap) { + this.nameMap = nameMap; + } + + /** + * 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 GetFunctionMapsOutputBody instance itself + */ + public GetFunctionMapsOutputBody 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; + } + GetFunctionMapsOutputBody getFunctionMapsOutputBody = (GetFunctionMapsOutputBody) o; + return Objects.equals(this.functionMap, getFunctionMapsOutputBody.functionMap) && + Objects.equals(this.inverseFunctionMap, getFunctionMapsOutputBody.inverseFunctionMap) && + Objects.equals(this.nameMap, getFunctionMapsOutputBody.nameMap)&& + Objects.equals(this.additionalProperties, getFunctionMapsOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(functionMap, inverseFunctionMap, nameMap, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFunctionMapsOutputBody {\n"); + sb.append(" functionMap: ").append(toIndentedString(functionMap)).append("\n"); + sb.append(" inverseFunctionMap: ").append(toIndentedString(inverseFunctionMap)).append("\n"); + sb.append(" nameMap: ").append(toIndentedString(nameMap)).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("function_map", "inverse_function_map", "name_map")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("function_map", "inverse_function_map", "name_map")); + } + + /** + * 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 GetFunctionMapsOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFunctionMapsOutputBody.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 GetFunctionMapsOutputBody is not found in the empty JSON string", GetFunctionMapsOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetFunctionMapsOutputBody.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 (!GetFunctionMapsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFunctionMapsOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetFunctionMapsOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFunctionMapsOutputBody 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 GetFunctionMapsOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetFunctionMapsOutputBody 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 GetFunctionMapsOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFunctionMapsOutputBody + * @throws IOException if the JSON string is invalid with respect to GetFunctionMapsOutputBody + */ + public static GetFunctionMapsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFunctionMapsOutputBody.class); + } + + /** + * Convert an instance of GetFunctionMapsOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GetPublicUserOutputBody.java b/src/main/java/ai/reveng/model/GetPublicUserOutputBody.java new file mode 100644 index 0000000..d0b46cd --- /dev/null +++ b/src/main/java/ai/reveng/model/GetPublicUserOutputBody.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; + +/** + * GetPublicUserOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetPublicUserOutputBody { + public static final String SERIALIZED_NAME_USER_ID = "user_id"; + @SerializedName(SERIALIZED_NAME_USER_ID) + @javax.annotation.Nonnull + private Long userId; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nonnull + private String username; + + public GetPublicUserOutputBody() { + } + + public GetPublicUserOutputBody userId(@javax.annotation.Nonnull Long userId) { + this.userId = userId; + return this; + } + + /** + * The user's ID + * @return userId + */ + @javax.annotation.Nonnull + public Long getUserId() { + return userId; + } + + public void setUserId(@javax.annotation.Nonnull Long userId) { + this.userId = userId; + } + + + public GetPublicUserOutputBody username(@javax.annotation.Nonnull String username) { + this.username = username; + return this; + } + + /** + * The user's display name + * @return username + */ + @javax.annotation.Nonnull + public String getUsername() { + return username; + } + + public void setUsername(@javax.annotation.Nonnull String username) { + this.username = username; + } + + /** + * 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 GetPublicUserOutputBody instance itself + */ + public GetPublicUserOutputBody 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; + } + GetPublicUserOutputBody getPublicUserOutputBody = (GetPublicUserOutputBody) o; + return Objects.equals(this.userId, getPublicUserOutputBody.userId) && + Objects.equals(this.username, getPublicUserOutputBody.username)&& + Objects.equals(this.additionalProperties, getPublicUserOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(userId, username, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetPublicUserOutputBody {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).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("user_id", "username")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("user_id", "username")); + } + + /** + * 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 GetPublicUserOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetPublicUserOutputBody.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 GetPublicUserOutputBody is not found in the empty JSON string", GetPublicUserOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetPublicUserOutputBody.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("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetPublicUserOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetPublicUserOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetPublicUserOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetPublicUserOutputBody 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 GetPublicUserOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetPublicUserOutputBody 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 GetPublicUserOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetPublicUserOutputBody + * @throws IOException if the JSON string is invalid with respect to GetPublicUserOutputBody + */ + public static GetPublicUserOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetPublicUserOutputBody.class); + } + + /** + * Convert an instance of GetPublicUserOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GetUserActivityOutputBody.java b/src/main/java/ai/reveng/model/GetUserActivityOutputBody.java new file mode 100644 index 0000000..32c0c75 --- /dev/null +++ b/src/main/java/ai/reveng/model/GetUserActivityOutputBody.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.ActivityBody; +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; + +/** + * GetUserActivityOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetUserActivityOutputBody { + public static final String SERIALIZED_NAME_ACTIVITIES = "activities"; + @SerializedName(SERIALIZED_NAME_ACTIVITIES) + @javax.annotation.Nullable + private List activities; + + public GetUserActivityOutputBody() { + } + + public GetUserActivityOutputBody activities(@javax.annotation.Nullable List activities) { + this.activities = activities; + return this; + } + + public GetUserActivityOutputBody addActivitiesItem(ActivityBody activitiesItem) { + if (this.activities == null) { + this.activities = new ArrayList<>(); + } + this.activities.add(activitiesItem); + return this; + } + + /** + * Recent activity visible to the caller: their own private activity, their team's, and everyone's public activity + * @return activities + */ + @javax.annotation.Nullable + public List getActivities() { + return activities; + } + + public void setActivities(@javax.annotation.Nullable List activities) { + this.activities = activities; + } + + /** + * 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 GetUserActivityOutputBody instance itself + */ + public GetUserActivityOutputBody 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; + } + GetUserActivityOutputBody getUserActivityOutputBody = (GetUserActivityOutputBody) o; + return Objects.equals(this.activities, getUserActivityOutputBody.activities)&& + Objects.equals(this.additionalProperties, getUserActivityOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(activities, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetUserActivityOutputBody {\n"); + sb.append(" activities: ").append(toIndentedString(activities)).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("activities")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("activities")); + } + + /** + * 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 GetUserActivityOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetUserActivityOutputBody.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 GetUserActivityOutputBody is not found in the empty JSON string", GetUserActivityOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetUserActivityOutputBody.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("activities") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("activities").isJsonArray() && !jsonObj.get("activities").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `activities` to be an array in the JSON string but got `%s`", jsonObj.get("activities").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetUserActivityOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetUserActivityOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetUserActivityOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetUserActivityOutputBody 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 GetUserActivityOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GetUserActivityOutputBody 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 GetUserActivityOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetUserActivityOutputBody + * @throws IOException if the JSON string is invalid with respect to GetUserActivityOutputBody + */ + public static GetUserActivityOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetUserActivityOutputBody.class); + } + + /** + * Convert an instance of GetUserActivityOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ListSecretStoreOutputBody.java b/src/main/java/ai/reveng/model/ListSecretStoreOutputBody.java new file mode 100644 index 0000000..79a6fe5 --- /dev/null +++ b/src/main/java/ai/reveng/model/ListSecretStoreOutputBody.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.SecretBody; +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; + +/** + * ListSecretStoreOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ListSecretStoreOutputBody { + public static final String SERIALIZED_NAME_SECRETS = "secrets"; + @SerializedName(SERIALIZED_NAME_SECRETS) + @javax.annotation.Nullable + private List secrets; + + public ListSecretStoreOutputBody() { + } + + public ListSecretStoreOutputBody secrets(@javax.annotation.Nullable List secrets) { + this.secrets = secrets; + return this; + } + + public ListSecretStoreOutputBody addSecretsItem(SecretBody secretsItem) { + if (this.secrets == null) { + this.secrets = new ArrayList<>(); + } + this.secrets.add(secretsItem); + return this; + } + + /** + * Get secrets + * @return secrets + */ + @javax.annotation.Nullable + public List getSecrets() { + return secrets; + } + + public void setSecrets(@javax.annotation.Nullable List secrets) { + this.secrets = secrets; + } + + /** + * 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 ListSecretStoreOutputBody instance itself + */ + public ListSecretStoreOutputBody 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; + } + ListSecretStoreOutputBody listSecretStoreOutputBody = (ListSecretStoreOutputBody) o; + return Objects.equals(this.secrets, listSecretStoreOutputBody.secrets)&& + Objects.equals(this.additionalProperties, listSecretStoreOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(secrets, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListSecretStoreOutputBody {\n"); + sb.append(" secrets: ").append(toIndentedString(secrets)).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("secrets")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("secrets")); + } + + /** + * 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 ListSecretStoreOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListSecretStoreOutputBody.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 ListSecretStoreOutputBody is not found in the empty JSON string", ListSecretStoreOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListSecretStoreOutputBody.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("secrets") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("secrets").isJsonArray() && !jsonObj.get("secrets").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `secrets` to be an array in the JSON string but got `%s`", jsonObj.get("secrets").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListSecretStoreOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListSecretStoreOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListSecretStoreOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListSecretStoreOutputBody 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 ListSecretStoreOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListSecretStoreOutputBody 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 ListSecretStoreOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListSecretStoreOutputBody + * @throws IOException if the JSON string is invalid with respect to ListSecretStoreOutputBody + */ + public static ListSecretStoreOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListSecretStoreOutputBody.class); + } + + /** + * Convert an instance of ListSecretStoreOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/OperationVirusTotalScanMetadataVirusTotalScanResult.java b/src/main/java/ai/reveng/model/OperationVirusTotalScanMetadataVirusTotalScanResult.java new file mode 100644 index 0000000..83bed9b --- /dev/null +++ b/src/main/java/ai/reveng/model/OperationVirusTotalScanMetadataVirusTotalScanResult.java @@ -0,0 +1,396 @@ +/* + * 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.Status; +import ai.reveng.model.VirusTotalScanMetadata; +import ai.reveng.model.VirusTotalScanResult; +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; + +/** + * OperationVirusTotalScanMetadataVirusTotalScanResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class OperationVirusTotalScanMetadataVirusTotalScanResult { + public static final String SERIALIZED_NAME_DONE = "done"; + @SerializedName(SERIALIZED_NAME_DONE) + @javax.annotation.Nonnull + private Boolean done; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nullable + private Status error; + + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + @javax.annotation.Nullable + private VirusTotalScanMetadata metadata; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_RESPONSE = "response"; + @SerializedName(SERIALIZED_NAME_RESPONSE) + @javax.annotation.Nullable + private VirusTotalScanResult response; + + public OperationVirusTotalScanMetadataVirusTotalScanResult() { + } + + public OperationVirusTotalScanMetadataVirusTotalScanResult done(@javax.annotation.Nonnull Boolean done) { + this.done = done; + return this; + } + + /** + * Whether the operation has reached a terminal state. + * @return done + */ + @javax.annotation.Nonnull + public Boolean getDone() { + return done; + } + + public void setDone(@javax.annotation.Nonnull Boolean done) { + this.done = done; + } + + + public OperationVirusTotalScanMetadataVirusTotalScanResult error(@javax.annotation.Nullable Status error) { + this.error = error; + return this; + } + + /** + * Failure detail, populated only when done is true and the operation failed. + * @return error + */ + @javax.annotation.Nullable + public Status getError() { + return error; + } + + public void setError(@javax.annotation.Nullable Status error) { + this.error = error; + } + + + public OperationVirusTotalScanMetadataVirusTotalScanResult metadata(@javax.annotation.Nullable VirusTotalScanMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * In-flight information and details. + * @return metadata + */ + @javax.annotation.Nullable + public VirusTotalScanMetadata getMetadata() { + return metadata; + } + + public void setMetadata(@javax.annotation.Nullable VirusTotalScanMetadata metadata) { + this.metadata = metadata; + } + + + public OperationVirusTotalScanMetadataVirusTotalScanResult name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * API resource name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public OperationVirusTotalScanMetadataVirusTotalScanResult response(@javax.annotation.Nullable VirusTotalScanResult response) { + this.response = response; + return this; + } + + /** + * Result, set only when done is true and the operation succeeded. + * @return response + */ + @javax.annotation.Nullable + public VirusTotalScanResult getResponse() { + return response; + } + + public void setResponse(@javax.annotation.Nullable VirusTotalScanResult response) { + this.response = response; + } + + /** + * 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 OperationVirusTotalScanMetadataVirusTotalScanResult instance itself + */ + public OperationVirusTotalScanMetadataVirusTotalScanResult 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; + } + OperationVirusTotalScanMetadataVirusTotalScanResult operationVirusTotalScanMetadataVirusTotalScanResult = (OperationVirusTotalScanMetadataVirusTotalScanResult) o; + return Objects.equals(this.done, operationVirusTotalScanMetadataVirusTotalScanResult.done) && + Objects.equals(this.error, operationVirusTotalScanMetadataVirusTotalScanResult.error) && + Objects.equals(this.metadata, operationVirusTotalScanMetadataVirusTotalScanResult.metadata) && + Objects.equals(this.name, operationVirusTotalScanMetadataVirusTotalScanResult.name) && + Objects.equals(this.response, operationVirusTotalScanMetadataVirusTotalScanResult.response)&& + Objects.equals(this.additionalProperties, operationVirusTotalScanMetadataVirusTotalScanResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(done, error, metadata, name, response, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OperationVirusTotalScanMetadataVirusTotalScanResult {\n"); + sb.append(" done: ").append(toIndentedString(done)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" response: ").append(toIndentedString(response)).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("done", "error", "metadata", "name", "response")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("done", "name")); + } + + /** + * 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 OperationVirusTotalScanMetadataVirusTotalScanResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OperationVirusTotalScanMetadataVirusTotalScanResult.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 OperationVirusTotalScanMetadataVirusTotalScanResult is not found in the empty JSON string", OperationVirusTotalScanMetadataVirusTotalScanResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OperationVirusTotalScanMetadataVirusTotalScanResult.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("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 (!OperationVirusTotalScanMetadataVirusTotalScanResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OperationVirusTotalScanMetadataVirusTotalScanResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OperationVirusTotalScanMetadataVirusTotalScanResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OperationVirusTotalScanMetadataVirusTotalScanResult 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 OperationVirusTotalScanMetadataVirusTotalScanResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OperationVirusTotalScanMetadataVirusTotalScanResult 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 OperationVirusTotalScanMetadataVirusTotalScanResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of OperationVirusTotalScanMetadataVirusTotalScanResult + * @throws IOException if the JSON string is invalid with respect to OperationVirusTotalScanMetadataVirusTotalScanResult + */ + public static OperationVirusTotalScanMetadataVirusTotalScanResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OperationVirusTotalScanMetadataVirusTotalScanResult.class); + } + + /** + * Convert an instance of OperationVirusTotalScanMetadataVirusTotalScanResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/RatingOutputBody.java b/src/main/java/ai/reveng/model/RatingOutputBody.java new file mode 100644 index 0000000..c780fd0 --- /dev/null +++ b/src/main/java/ai/reveng/model/RatingOutputBody.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; + +/** + * RatingOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RatingOutputBody { + /** + * The rating the caller recorded, or null when they have not rated it yet + */ + @JsonAdapter(RatingEnum.Adapter.class) + public enum RatingEnum { + POSITIVE("POSITIVE"), + + NEUTRAL("NEUTRAL"), + + NEGATIVE("NEGATIVE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RatingEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RatingEnum fromValue(String value) { + for (RatingEnum b : RatingEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RatingEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RatingEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RatingEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RatingEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RATING = "rating"; + @SerializedName(SERIALIZED_NAME_RATING) + @javax.annotation.Nullable + private RatingEnum rating; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + public RatingOutputBody() { + } + + public RatingOutputBody rating(@javax.annotation.Nullable RatingEnum rating) { + this.rating = rating; + return this; + } + + /** + * The rating the caller recorded, or null when they have not rated it yet + * @return rating + */ + @javax.annotation.Nullable + public RatingEnum getRating() { + return rating; + } + + public void setRating(@javax.annotation.Nullable RatingEnum rating) { + this.rating = rating; + } + + + public RatingOutputBody reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * The reason the caller gave, or null + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + /** + * 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 RatingOutputBody instance itself + */ + public RatingOutputBody 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; + } + RatingOutputBody ratingOutputBody = (RatingOutputBody) o; + return Objects.equals(this.rating, ratingOutputBody.rating) && + Objects.equals(this.reason, ratingOutputBody.reason)&& + Objects.equals(this.additionalProperties, ratingOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(rating, reason, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RatingOutputBody {\n"); + sb.append(" rating: ").append(toIndentedString(rating)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).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("rating", "reason")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("rating", "reason")); + } + + /** + * 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 RatingOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RatingOutputBody.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 RatingOutputBody is not found in the empty JSON string", RatingOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RatingOutputBody.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("rating") != null && !jsonObj.get("rating").isJsonNull()) && !jsonObj.get("rating").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `rating` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rating").toString())); + } + if (jsonObj.get("rating") != null && !jsonObj.get("rating").isJsonNull()) { + // validate the required field `rating` + RatingEnum.validateJsonElement(jsonObj.get("rating")); + } + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RatingOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RatingOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RatingOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RatingOutputBody 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 RatingOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RatingOutputBody 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 RatingOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of RatingOutputBody + * @throws IOException if the JSON string is invalid with respect to RatingOutputBody + */ + public static RatingOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RatingOutputBody.class); + } + + /** + * Convert an instance of RatingOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ResendVerificationEmailInputBody.java b/src/main/java/ai/reveng/model/ResendVerificationEmailInputBody.java new file mode 100644 index 0000000..ab173f3 --- /dev/null +++ b/src/main/java/ai/reveng/model/ResendVerificationEmailInputBody.java @@ -0,0 +1,289 @@ +/* + * 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; + +/** + * ResendVerificationEmailInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ResendVerificationEmailInputBody { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + @javax.annotation.Nonnull + private String email; + + public ResendVerificationEmailInputBody() { + } + + public ResendVerificationEmailInputBody email(@javax.annotation.Nonnull String email) { + this.email = email; + return this; + } + + /** + * Email address of the account to resend a verification code to + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(@javax.annotation.Nonnull String email) { + this.email = email; + } + + /** + * 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 ResendVerificationEmailInputBody instance itself + */ + public ResendVerificationEmailInputBody 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; + } + ResendVerificationEmailInputBody resendVerificationEmailInputBody = (ResendVerificationEmailInputBody) o; + return Objects.equals(this.email, resendVerificationEmailInputBody.email)&& + Objects.equals(this.additionalProperties, resendVerificationEmailInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(email, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResendVerificationEmailInputBody {\n"); + sb.append(" email: ").append(toIndentedString(email)).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("email")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("email")); + } + + /** + * 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 ResendVerificationEmailInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResendVerificationEmailInputBody.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 ResendVerificationEmailInputBody is not found in the empty JSON string", ResendVerificationEmailInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResendVerificationEmailInputBody.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("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResendVerificationEmailInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResendVerificationEmailInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResendVerificationEmailInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResendVerificationEmailInputBody 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 ResendVerificationEmailInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResendVerificationEmailInputBody 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 ResendVerificationEmailInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResendVerificationEmailInputBody + * @throws IOException if the JSON string is invalid with respect to ResendVerificationEmailInputBody + */ + public static ResendVerificationEmailInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResendVerificationEmailInputBody.class); + } + + /** + * Convert an instance of ResendVerificationEmailInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SecretBody.java b/src/main/java/ai/reveng/model/SecretBody.java new file mode 100644 index 0000000..8984166 --- /dev/null +++ b/src/main/java/ai/reveng/model/SecretBody.java @@ -0,0 +1,557 @@ +/* + * 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; + +/** + * SecretBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SecretBody { + public static final String SERIALIZED_NAME_ACTIVE = "active"; + @SerializedName(SERIALIZED_NAME_ACTIVE) + @javax.annotation.Nonnull + private Boolean active; + + /** + * Gets or Sets apiProvider + */ + @JsonAdapter(ApiProviderEnum.Adapter.class) + public enum ApiProviderEnum { + VIRUS_TOTAL("virus_total"), + + MALWARE_BAZAAR("malware_bazaar"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ApiProviderEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ApiProviderEnum fromValue(String value) { + for (ApiProviderEnum b : ApiProviderEnum.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 ApiProviderEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ApiProviderEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ApiProviderEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ApiProviderEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_API_PROVIDER = "api_provider"; + @SerializedName(SERIALIZED_NAME_API_PROVIDER) + @javax.annotation.Nonnull + private ApiProviderEnum apiProvider; + + public static final String SERIALIZED_NAME_CREATION = "creation"; + @SerializedName(SERIALIZED_NAME_CREATION) + @javax.annotation.Nonnull + private OffsetDateTime creation; + + public static final String SERIALIZED_NAME_DISABLED_AT = "disabled_at"; + @SerializedName(SERIALIZED_NAME_DISABLED_AT) + @javax.annotation.Nullable + private OffsetDateTime disabledAt; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nonnull + private Long id; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nonnull + private String key; + + public static final String SERIALIZED_NAME_TEAM_ID = "team_id"; + @SerializedName(SERIALIZED_NAME_TEAM_ID) + @javax.annotation.Nullable + private Long teamId; + + public static final String SERIALIZED_NAME_USER_ID = "user_id"; + @SerializedName(SERIALIZED_NAME_USER_ID) + @javax.annotation.Nonnull + private Long userId; + + public static final String SERIALIZED_NAME_VALID = "valid"; + @SerializedName(SERIALIZED_NAME_VALID) + @javax.annotation.Nonnull + private Boolean valid; + + public SecretBody() { + } + + public SecretBody active(@javax.annotation.Nonnull Boolean active) { + this.active = active; + return this; + } + + /** + * Get active + * @return active + */ + @javax.annotation.Nonnull + public Boolean getActive() { + return active; + } + + public void setActive(@javax.annotation.Nonnull Boolean active) { + this.active = active; + } + + + public SecretBody apiProvider(@javax.annotation.Nonnull ApiProviderEnum apiProvider) { + this.apiProvider = apiProvider; + return this; + } + + /** + * Get apiProvider + * @return apiProvider + */ + @javax.annotation.Nonnull + public ApiProviderEnum getApiProvider() { + return apiProvider; + } + + public void setApiProvider(@javax.annotation.Nonnull ApiProviderEnum apiProvider) { + this.apiProvider = apiProvider; + } + + + public SecretBody creation(@javax.annotation.Nonnull OffsetDateTime creation) { + this.creation = creation; + return this; + } + + /** + * Get creation + * @return creation + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreation() { + return creation; + } + + public void setCreation(@javax.annotation.Nonnull OffsetDateTime creation) { + this.creation = creation; + } + + + public SecretBody disabledAt(@javax.annotation.Nullable OffsetDateTime disabledAt) { + this.disabledAt = disabledAt; + return this; + } + + /** + * Get disabledAt + * @return disabledAt + */ + @javax.annotation.Nullable + public OffsetDateTime getDisabledAt() { + return disabledAt; + } + + public void setDisabledAt(@javax.annotation.Nullable OffsetDateTime disabledAt) { + this.disabledAt = disabledAt; + } + + + public SecretBody id(@javax.annotation.Nonnull Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @javax.annotation.Nonnull + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nonnull Long id) { + this.id = id; + } + + + public SecretBody key(@javax.annotation.Nonnull String key) { + this.key = key; + return this; + } + + /** + * Masked API key showing only the last 4 characters + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(@javax.annotation.Nonnull String key) { + this.key = key; + } + + + public SecretBody teamId(@javax.annotation.Nullable Long teamId) { + this.teamId = teamId; + return this; + } + + /** + * Null for a personal secret + * @return teamId + */ + @javax.annotation.Nullable + public Long getTeamId() { + return teamId; + } + + public void setTeamId(@javax.annotation.Nullable Long teamId) { + this.teamId = teamId; + } + + + public SecretBody userId(@javax.annotation.Nonnull Long userId) { + this.userId = userId; + return this; + } + + /** + * Get userId + * @return userId + */ + @javax.annotation.Nonnull + public Long getUserId() { + return userId; + } + + public void setUserId(@javax.annotation.Nonnull Long userId) { + this.userId = userId; + } + + + public SecretBody valid(@javax.annotation.Nonnull Boolean valid) { + this.valid = valid; + return this; + } + + /** + * Get valid + * @return valid + */ + @javax.annotation.Nonnull + public Boolean getValid() { + return valid; + } + + public void setValid(@javax.annotation.Nonnull Boolean valid) { + this.valid = valid; + } + + /** + * 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 SecretBody instance itself + */ + public SecretBody 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; + } + SecretBody secretBody = (SecretBody) o; + return Objects.equals(this.active, secretBody.active) && + Objects.equals(this.apiProvider, secretBody.apiProvider) && + Objects.equals(this.creation, secretBody.creation) && + Objects.equals(this.disabledAt, secretBody.disabledAt) && + Objects.equals(this.id, secretBody.id) && + Objects.equals(this.key, secretBody.key) && + Objects.equals(this.teamId, secretBody.teamId) && + Objects.equals(this.userId, secretBody.userId) && + Objects.equals(this.valid, secretBody.valid)&& + Objects.equals(this.additionalProperties, secretBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(active, apiProvider, creation, disabledAt, id, key, teamId, userId, valid, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SecretBody {\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" apiProvider: ").append(toIndentedString(apiProvider)).append("\n"); + sb.append(" creation: ").append(toIndentedString(creation)).append("\n"); + sb.append(" disabledAt: ").append(toIndentedString(disabledAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" teamId: ").append(toIndentedString(teamId)).append("\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" valid: ").append(toIndentedString(valid)).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("active", "api_provider", "creation", "disabled_at", "id", "key", "team_id", "user_id", "valid")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("active", "api_provider", "creation", "id", "key", "user_id", "valid")); + } + + /** + * 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 SecretBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SecretBody.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 SecretBody is not found in the empty JSON string", SecretBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SecretBody.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("api_provider").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `api_provider` to be a primitive type in the JSON string but got `%s`", jsonObj.get("api_provider").toString())); + } + // validate the required field `api_provider` + ApiProviderEnum.validateJsonElement(jsonObj.get("api_provider")); + 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 (!SecretBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SecretBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SecretBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SecretBody 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 SecretBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SecretBody 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 SecretBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SecretBody + * @throws IOException if the JSON string is invalid with respect to SecretBody + */ + public static SecretBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SecretBody.class); + } + + /** + * Convert an instance of SecretBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Status.java b/src/main/java/ai/reveng/model/Status.java index 5c95e6a..a886e17 100644 --- a/src/main/java/ai/reveng/model/Status.java +++ b/src/main/java/ai/reveng/model/Status.java @@ -118,6 +118,8 @@ public enum CodeEnum { NO_PENDING_CONFIRMATION("NO_PENDING_CONFIRMATION"), + NO_VIRUSTOTAL_KEY("NO_VIRUSTOTAL_KEY"), + OIDC_DISCOVERY_FAILED("OIDC_DISCOVERY_FAILED"), PASSWORD_RESET_REQUIRED("PASSWORD_RESET_REQUIRED"), diff --git a/src/main/java/ai/reveng/model/SubmitFeedbackBody.java b/src/main/java/ai/reveng/model/SubmitFeedbackBody.java new file mode 100644 index 0000000..3e351cb --- /dev/null +++ b/src/main/java/ai/reveng/model/SubmitFeedbackBody.java @@ -0,0 +1,347 @@ +/* + * 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; + +/** + * SubmitFeedbackBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SubmitFeedbackBody { + public static final String SERIALIZED_NAME_CURRENT_ROUTE = "current_route"; + @SerializedName(SERIALIZED_NAME_CURRENT_ROUTE) + @javax.annotation.Nonnull + private String currentRoute; + + public static final String SERIALIZED_NAME_FEEDBACK = "feedback"; + @SerializedName(SERIALIZED_NAME_FEEDBACK) + @javax.annotation.Nonnull + private String feedback; + + public static final String SERIALIZED_NAME_SCREEN_CAPTURE_URL = "screen_capture_url"; + @SerializedName(SERIALIZED_NAME_SCREEN_CAPTURE_URL) + @javax.annotation.Nullable + private String screenCaptureUrl; + + public SubmitFeedbackBody() { + } + + public SubmitFeedbackBody currentRoute(@javax.annotation.Nonnull String currentRoute) { + this.currentRoute = currentRoute; + return this; + } + + /** + * The route the caller was on when they submitted feedback + * @return currentRoute + */ + @javax.annotation.Nonnull + public String getCurrentRoute() { + return currentRoute; + } + + public void setCurrentRoute(@javax.annotation.Nonnull String currentRoute) { + this.currentRoute = currentRoute; + } + + + public SubmitFeedbackBody feedback(@javax.annotation.Nonnull String feedback) { + this.feedback = feedback; + return this; + } + + /** + * The feedback text + * @return feedback + */ + @javax.annotation.Nonnull + public String getFeedback() { + return feedback; + } + + public void setFeedback(@javax.annotation.Nonnull String feedback) { + this.feedback = feedback; + } + + + public SubmitFeedbackBody screenCaptureUrl(@javax.annotation.Nullable String screenCaptureUrl) { + this.screenCaptureUrl = screenCaptureUrl; + return this; + } + + /** + * Optional URL to a screen capture related to the feedback + * @return screenCaptureUrl + */ + @javax.annotation.Nullable + public String getScreenCaptureUrl() { + return screenCaptureUrl; + } + + public void setScreenCaptureUrl(@javax.annotation.Nullable String screenCaptureUrl) { + this.screenCaptureUrl = screenCaptureUrl; + } + + /** + * 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 SubmitFeedbackBody instance itself + */ + public SubmitFeedbackBody 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; + } + SubmitFeedbackBody submitFeedbackBody = (SubmitFeedbackBody) o; + return Objects.equals(this.currentRoute, submitFeedbackBody.currentRoute) && + Objects.equals(this.feedback, submitFeedbackBody.feedback) && + Objects.equals(this.screenCaptureUrl, submitFeedbackBody.screenCaptureUrl)&& + Objects.equals(this.additionalProperties, submitFeedbackBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(currentRoute, feedback, screenCaptureUrl, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitFeedbackBody {\n"); + sb.append(" currentRoute: ").append(toIndentedString(currentRoute)).append("\n"); + sb.append(" feedback: ").append(toIndentedString(feedback)).append("\n"); + sb.append(" screenCaptureUrl: ").append(toIndentedString(screenCaptureUrl)).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("current_route", "feedback", "screen_capture_url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("current_route", "feedback")); + } + + /** + * 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 SubmitFeedbackBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitFeedbackBody.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 SubmitFeedbackBody is not found in the empty JSON string", SubmitFeedbackBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SubmitFeedbackBody.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("current_route").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `current_route` to be a primitive type in the JSON string but got `%s`", jsonObj.get("current_route").toString())); + } + if (!jsonObj.get("feedback").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `feedback` to be a primitive type in the JSON string but got `%s`", jsonObj.get("feedback").toString())); + } + if ((jsonObj.get("screen_capture_url") != null && !jsonObj.get("screen_capture_url").isJsonNull()) && !jsonObj.get("screen_capture_url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `screen_capture_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("screen_capture_url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubmitFeedbackBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubmitFeedbackBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubmitFeedbackBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubmitFeedbackBody 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 SubmitFeedbackBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SubmitFeedbackBody 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 SubmitFeedbackBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitFeedbackBody + * @throws IOException if the JSON string is invalid with respect to SubmitFeedbackBody + */ + public static SubmitFeedbackBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitFeedbackBody.class); + } + + /** + * Convert an instance of SubmitFeedbackBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SubmitFeedbackOutputBody.java b/src/main/java/ai/reveng/model/SubmitFeedbackOutputBody.java new file mode 100644 index 0000000..546e2b7 --- /dev/null +++ b/src/main/java/ai/reveng/model/SubmitFeedbackOutputBody.java @@ -0,0 +1,289 @@ +/* + * 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; + +/** + * SubmitFeedbackOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SubmitFeedbackOutputBody { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + @javax.annotation.Nonnull + private String message; + + public SubmitFeedbackOutputBody() { + } + + public SubmitFeedbackOutputBody message(@javax.annotation.Nonnull String message) { + this.message = message; + return this; + } + + /** + * Confirmation message + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(@javax.annotation.Nonnull String message) { + this.message = message; + } + + /** + * 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 SubmitFeedbackOutputBody instance itself + */ + public SubmitFeedbackOutputBody 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; + } + SubmitFeedbackOutputBody submitFeedbackOutputBody = (SubmitFeedbackOutputBody) o; + return Objects.equals(this.message, submitFeedbackOutputBody.message)&& + Objects.equals(this.additionalProperties, submitFeedbackOutputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(message, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SubmitFeedbackOutputBody {\n"); + sb.append(" message: ").append(toIndentedString(message)).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("message")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("message")); + } + + /** + * 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 SubmitFeedbackOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SubmitFeedbackOutputBody.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 SubmitFeedbackOutputBody is not found in the empty JSON string", SubmitFeedbackOutputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SubmitFeedbackOutputBody.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("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SubmitFeedbackOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SubmitFeedbackOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SubmitFeedbackOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SubmitFeedbackOutputBody 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 SubmitFeedbackOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SubmitFeedbackOutputBody 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 SubmitFeedbackOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of SubmitFeedbackOutputBody + * @throws IOException if the JSON string is invalid with respect to SubmitFeedbackOutputBody + */ + public static SubmitFeedbackOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SubmitFeedbackOutputBody.class); + } + + /** + * Convert an instance of SubmitFeedbackOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateSecretStoreInputBody.java b/src/main/java/ai/reveng/model/UpdateSecretStoreInputBody.java new file mode 100644 index 0000000..6872200 --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateSecretStoreInputBody.java @@ -0,0 +1,308 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import 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; + +/** + * UpdateSecretStoreInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateSecretStoreInputBody { + public static final String SERIALIZED_NAME_ACTIVE = "active"; + @SerializedName(SERIALIZED_NAME_ACTIVE) + @javax.annotation.Nullable + private Boolean active; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nullable + private String key; + + public UpdateSecretStoreInputBody() { + } + + public UpdateSecretStoreInputBody active(@javax.annotation.Nullable Boolean active) { + this.active = active; + return this; + } + + /** + * Activates or deactivates the secret. Omit to leave unchanged. + * @return active + */ + @javax.annotation.Nullable + public Boolean getActive() { + return active; + } + + public void setActive(@javax.annotation.Nullable Boolean active) { + this.active = active; + } + + + public UpdateSecretStoreInputBody key(@javax.annotation.Nullable String key) { + this.key = key; + return this; + } + + /** + * New API key. Omit to leave the current key unchanged. + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + public void setKey(@javax.annotation.Nullable String key) { + this.key = key; + } + + /** + * 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 UpdateSecretStoreInputBody instance itself + */ + public UpdateSecretStoreInputBody 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; + } + UpdateSecretStoreInputBody updateSecretStoreInputBody = (UpdateSecretStoreInputBody) o; + return Objects.equals(this.active, updateSecretStoreInputBody.active) && + Objects.equals(this.key, updateSecretStoreInputBody.key)&& + Objects.equals(this.additionalProperties, updateSecretStoreInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(active, key, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSecretStoreInputBody {\n"); + sb.append(" active: ").append(toIndentedString(active)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).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("active", "key")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 UpdateSecretStoreInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSecretStoreInputBody.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 UpdateSecretStoreInputBody is not found in the empty JSON string", UpdateSecretStoreInputBody.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !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 (!UpdateSecretStoreInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSecretStoreInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSecretStoreInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSecretStoreInputBody 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 UpdateSecretStoreInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSecretStoreInputBody 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 UpdateSecretStoreInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSecretStoreInputBody + * @throws IOException if the JSON string is invalid with respect to UpdateSecretStoreInputBody + */ + public static UpdateSecretStoreInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSecretStoreInputBody.class); + } + + /** + * Convert an instance of UpdateSecretStoreInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpsertRatingInputBody.java b/src/main/java/ai/reveng/model/UpsertRatingInputBody.java new file mode 100644 index 0000000..3fa1f43 --- /dev/null +++ b/src/main/java/ai/reveng/model/UpsertRatingInputBody.java @@ -0,0 +1,376 @@ +/* + * 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; + +/** + * UpsertRatingInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpsertRatingInputBody { + /** + * How useful the caller found this AI decompilation + */ + @JsonAdapter(RatingEnum.Adapter.class) + public enum RatingEnum { + POSITIVE("POSITIVE"), + + NEUTRAL("NEUTRAL"), + + NEGATIVE("NEGATIVE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RatingEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RatingEnum fromValue(String value) { + for (RatingEnum b : RatingEnum.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 RatingEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RatingEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RatingEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RatingEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_RATING = "rating"; + @SerializedName(SERIALIZED_NAME_RATING) + @javax.annotation.Nonnull + private RatingEnum rating; + + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + @javax.annotation.Nullable + private String reason; + + public UpsertRatingInputBody() { + } + + public UpsertRatingInputBody rating(@javax.annotation.Nonnull RatingEnum rating) { + this.rating = rating; + return this; + } + + /** + * How useful the caller found this AI decompilation + * @return rating + */ + @javax.annotation.Nonnull + public RatingEnum getRating() { + return rating; + } + + public void setRating(@javax.annotation.Nonnull RatingEnum rating) { + this.rating = rating; + } + + + public UpsertRatingInputBody reason(@javax.annotation.Nullable String reason) { + this.reason = reason; + return this; + } + + /** + * Optional free-text reason for the rating + * @return reason + */ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + public void setReason(@javax.annotation.Nullable String reason) { + this.reason = reason; + } + + /** + * 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 UpsertRatingInputBody instance itself + */ + public UpsertRatingInputBody 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; + } + UpsertRatingInputBody upsertRatingInputBody = (UpsertRatingInputBody) o; + return Objects.equals(this.rating, upsertRatingInputBody.rating) && + Objects.equals(this.reason, upsertRatingInputBody.reason)&& + Objects.equals(this.additionalProperties, upsertRatingInputBody.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(rating, reason, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertRatingInputBody {\n"); + sb.append(" rating: ").append(toIndentedString(rating)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).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("rating", "reason")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("rating")); + } + + /** + * 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 UpsertRatingInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertRatingInputBody.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 UpsertRatingInputBody is not found in the empty JSON string", UpsertRatingInputBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertRatingInputBody.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("rating").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `rating` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rating").toString())); + } + // validate the required field `rating` + RatingEnum.validateJsonElement(jsonObj.get("rating")); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertRatingInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertRatingInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertRatingInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertRatingInputBody 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 UpsertRatingInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpsertRatingInputBody 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 UpsertRatingInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertRatingInputBody + * @throws IOException if the JSON string is invalid with respect to UpsertRatingInputBody + */ + public static UpsertRatingInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertRatingInputBody.class); + } + + /** + * Convert an instance of UpsertRatingInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/VirusTotalScanMetadata.java b/src/main/java/ai/reveng/model/VirusTotalScanMetadata.java new file mode 100644 index 0000000..ff3bed0 --- /dev/null +++ b/src/main/java/ai/reveng/model/VirusTotalScanMetadata.java @@ -0,0 +1,351 @@ +/* + * 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; + +/** + * VirusTotalScanMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class VirusTotalScanMetadata { + /** + * Lookup status. UNINITIALISED means this binary has never had a lookup triggered. + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + UNINITIALISED("UNINITIALISED"), + + PENDING("PENDING"), + + RUNNING("RUNNING"), + + COMPLETED("COMPLETED"), + + FAILED("FAILED"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.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 StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nonnull + private StatusEnum status; + + public VirusTotalScanMetadata() { + } + + public VirusTotalScanMetadata status(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + return this; + } + + /** + * Lookup status. UNINITIALISED means this binary has never had a lookup triggered. + * @return status + */ + @javax.annotation.Nonnull + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nonnull StatusEnum status) { + this.status = status; + } + + /** + * 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 VirusTotalScanMetadata instance itself + */ + public VirusTotalScanMetadata 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; + } + VirusTotalScanMetadata virusTotalScanMetadata = (VirusTotalScanMetadata) o; + return Objects.equals(this.status, virusTotalScanMetadata.status)&& + Objects.equals(this.additionalProperties, virusTotalScanMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VirusTotalScanMetadata {\n"); + sb.append(" status: ").append(toIndentedString(status)).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("status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("status")); + } + + /** + * 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 VirusTotalScanMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VirusTotalScanMetadata.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 VirusTotalScanMetadata is not found in the empty JSON string", VirusTotalScanMetadata.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VirusTotalScanMetadata.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("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the required field `status` + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VirusTotalScanMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VirusTotalScanMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VirusTotalScanMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VirusTotalScanMetadata 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 VirusTotalScanMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VirusTotalScanMetadata 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 VirusTotalScanMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of VirusTotalScanMetadata + * @throws IOException if the JSON string is invalid with respect to VirusTotalScanMetadata + */ + public static VirusTotalScanMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VirusTotalScanMetadata.class); + } + + /** + * Convert an instance of VirusTotalScanMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/VirusTotalScanResult.java b/src/main/java/ai/reveng/model/VirusTotalScanResult.java new file mode 100644 index 0000000..c5fea1d --- /dev/null +++ b/src/main/java/ai/reveng/model/VirusTotalScanResult.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.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; + +/** + * VirusTotalScanResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class VirusTotalScanResult { + 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 VirusTotalScanResult() { + } + + public VirusTotalScanResult sha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + return this; + } + + /** + * Content hash the lookup was keyed by + * @return sha256Hash + */ + @javax.annotation.Nonnull + public String getSha256Hash() { + return sha256Hash; + } + + public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { + this.sha256Hash = sha256Hash; + } + + + public VirusTotalScanResult 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 VirusTotalScanResult vtLastUpdated(@javax.annotation.Nonnull OffsetDateTime vtLastUpdated) { + this.vtLastUpdated = vtLastUpdated; + return this; + } + + /** + * When this result was recorded + * @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 VirusTotalScanResult instance itself + */ + public VirusTotalScanResult 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; + } + VirusTotalScanResult virusTotalScanResult = (VirusTotalScanResult) o; + return Objects.equals(this.sha256Hash, virusTotalScanResult.sha256Hash) && + Objects.equals(this.vt, virusTotalScanResult.vt) && + Objects.equals(this.vtLastUpdated, virusTotalScanResult.vtLastUpdated)&& + Objects.equals(this.additionalProperties, virusTotalScanResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(sha256Hash, vt, vtLastUpdated, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VirusTotalScanResult {\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("sha_256_hash", "vt", "vt_last_updated")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("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 VirusTotalScanResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VirusTotalScanResult.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 VirusTotalScanResult is not found in the empty JSON string", VirusTotalScanResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VirusTotalScanResult.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 (!VirusTotalScanResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VirusTotalScanResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VirusTotalScanResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VirusTotalScanResult 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 VirusTotalScanResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VirusTotalScanResult 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 VirusTotalScanResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of VirusTotalScanResult + * @throws IOException if the JSON string is invalid with respect to VirusTotalScanResult + */ + public static VirusTotalScanResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VirusTotalScanResult.class); + } + + /** + * Convert an instance of VirusTotalScanResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} +