From e357a9e6215f735b1c1203e8b28f08b6a4b322d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 24 Aug 2026 07:22:11 +0000 Subject: [PATCH] Update SDK to version v4.4.0 - Generated from OpenAPI spec version v4.4.0 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 152 +- build.gradle | 4 +- build.sbt | 2 +- docs/AIDecompFunctionMapping.md | 26 - docs/AIDecompInverseFunctionMapItem.md | 15 - docs/AgentApi.md | 315 +++ docs/AnalysesCoreApi.md | 78 + docs/AnalysisBasicInfoOutputBody.md | 6 + docs/AnalysisDataTypesGroup.md | 14 + docs/AnalysisDataTypesOutputBody.md | 13 + docs/AnalysisLogEntry.md | 27 + docs/AnalysisRecordBody.md | 6 + docs/Argument.md | 17 - docs/ArrayDataType.md | 43 + docs/ArrayDefinition.md | 14 + docs/BaseDataType.md | 42 + docs/BaseResponseFunctionDataTypes.md | 17 - docs/BaseResponseFunctionDataTypesList.md | 17 - docs/BaseResponseGenerateFunctionDataTypes.md | 17 - docs/BaseResponseGenerationStatusList.md | 17 - docs/BatchFunctionSignatureEntry.md | 33 + docs/BatchUpdateDataTypesInputBody.md | 13 - docs/BatchUpdateDataTypesItem.md | 15 - docs/BatchUpdateDataTypesOutputBody.md | 13 - docs/BatchUpdateDataTypesResult.md | 28 - docs/BitfieldDataType.md | 42 + docs/CollectionsApi.md | 3 +- docs/ConfigResponse.md | 2 +- docs/CopyFunctionSignaturesInputBody.md | 13 + docs/CopyFunctionSignaturesOutputBody.md | 14 + docs/CopySignatureItem.md | 14 + docs/CreateAnalysisDataTypesInputBody.md | 13 + docs/CreateArrayDataType.md | 26 + docs/CreateBaseDataType.md | 25 + docs/CreateBitfieldDataType.md | 25 + docs/CreateDataTypeEntry.md | 27 + docs/CreateEnumDataType.md | 26 + docs/CreateFunctionDataType.md | 26 + docs/CreatePointerDataType.md | 26 + docs/CreateStructDataType.md | 26 + docs/CreateTypedefDataType.md | 26 + docs/CreateUnionDataType.md | 26 + docs/CreateUnknownDataType.md | 25 + docs/DataTypeEntry.md | 44 + docs/DataTypeEnumValueEntry.md | 14 + docs/DataTypeFunctionEntry.md | 14 + docs/DataTypeFunctionParameterEntry.md | 16 + docs/DataTypeMemberEntry.md | 19 + docs/DataTypeVersion.md | 15 + docs/DataTypesApi.md | 917 ++++++++ docs/DataTypesEntry.md | 15 - docs/DisassemblyOutputBody.md | 1 + docs/DynamicExecutionStatusResponse.md | 2 +- docs/EnumDataType.md | 43 + docs/EnumDefinition.md | 13 + docs/Enumeration.md | 16 - docs/FuncDepsInner.md | 19 - docs/FunctionArgument.md | 18 - docs/FunctionDataType.md | 43 + docs/FunctionDataTypes.md | 16 - docs/FunctionDataTypesList.md | 15 - docs/FunctionDataTypesListItem.md | 17 - docs/FunctionDataTypesParams.md | 13 - docs/FunctionDataTypesStatus.md | 15 - docs/FunctionDependency.md | 20 - docs/FunctionHeader.md | 18 - docs/FunctionInfo.md | 14 - docs/FunctionRename.md | 1 + docs/FunctionSignatureBody.md | 33 + docs/FunctionSignatureEntry.md | 32 + docs/FunctionSignatureVersion.md | 15 + docs/FunctionStackVariable.md | 19 - docs/FunctionType.md | 21 - docs/FunctionTypeDefinition.md | 14 + docs/FunctionsAiDecompilationApi.md | 240 ++- docs/FunctionsCoreApi.md | 3 +- docs/FunctionsDataTypesApi.md | 718 ------- docs/FunctionsRenamingHistoryApi.md | 2 +- docs/GenerateFunctionDataTypes.md | 15 - docs/GenerationStatusList.md | 15 - docs/GetAnalysisLogsOutputBody.md | 13 + docs/GetDataTypeHistoryBody.md | 13 + docs/GetFunctionSignatureHistoryBody.md | 13 + docs/GetTokensResponse.md | 16 + docs/GlobalVariable.md | 18 - docs/HistoryActor.md | 14 + docs/LineAttributionsData.md | 13 + docs/ListAnalysisDataTypesOutputBody.md | 14 + ...istAnalysisFunctionsDataTypesOutputBody.md | 14 - docs/ListDataTypeFunctionsBody.md | 14 + docs/ListFunctionSignaturesOutputBody.md | 14 + docs/MatchFilters.md | 21 +- docs/PointerDataType.md | 43 + ...placementValue.md => PointerDefinition.md} | 4 +- docs/RenameUnnamedFunctionsResult.md | 17 + docs/RenderedToken.md | 38 + docs/ResolvedEntity.md | 60 + docs/SegmentInfo.md | 3 +- docs/SignatureParameterEntry.md | 17 + docs/SignatureParameterInput.md | 17 + docs/SignatureStorageEntry.md | 14 + docs/SignatureStorageInput.md | 14 + docs/StackVariable.md | 18 - docs/StatusBody.md | 28 + docs/StructDataType.md | 43 + docs/StructDefinition.md | 13 + docs/Structure.md | 17 - docs/StructureMember.md | 17 - ...nctionsDataTypesOutputBody.md => Token.md} | 4 +- docs/TokenisedData.md | 3 +- .../TriggerRenameUnnamedFunctionsInputBody.md | 13 + docs/TypeDefinition.md | 16 - docs/TypedefDataType.md | 43 + ...eStringMapItem.md => TypedefDefinition.md} | 5 +- docs/UnionDataType.md | 43 + docs/UnionDefinition.md | 13 + docs/UnknownDataType.md | 42 + docs/UpdateAnalysisDataTypesInputBody.md | 13 + docs/UpdateArrayDataType.md | 27 + docs/UpdateBaseDataType.md | 26 + docs/UpdateBitfieldDataType.md | 26 + docs/UpdateDataTypeEntry.md | 28 + docs/UpdateDataTypesInputBody.md | 14 - docs/UpdateDataTypesOutputBody.md | 15 - docs/UpdateEnumDataType.md | 27 + docs/UpdateFunctionDataType.md | 27 + docs/UpdateFunctionSignatureInputBody.md | 15 + docs/UpdatePointerDataType.md | 27 + docs/UpdateStructDataType.md | 27 + docs/UpdateTypedefDataType.md | 27 + docs/UpdateUnionDataType.md | 27 + docs/UpdateUnknownDataType.md | 26 + docs/UpsertOverridesData.md | 2 +- docs/UpsertOverridesInputBody.md | 2 +- docs/V2FunctionHeader.md | 17 - docs/V2FunctionInfo.md | 14 - docs/V2FunctionType.md | 20 - pom.xml | 2 +- src/main/java/ai/reveng/api/AgentApi.java | 590 ++++++ .../java/ai/reveng/api/AnalysesCoreApi.java | 153 ++ .../java/ai/reveng/api/CollectionsApi.java | 10 +- src/main/java/ai/reveng/api/DataTypesApi.java | 1888 +++++++++++++++++ .../api/FunctionsAiDecompilationApi.java | 614 +++--- .../java/ai/reveng/api/FunctionsCoreApi.java | 10 +- .../ai/reveng/api/FunctionsDataTypesApi.java | 1434 ------------- .../api/FunctionsRenamingHistoryApi.java | 6 +- .../java/ai/reveng/invoker/ApiClient.java | 2 +- .../java/ai/reveng/invoker/Configuration.java | 2 +- src/main/java/ai/reveng/invoker/JSON.java | 175 +- .../reveng/model/AIDecompFunctionMapping.java | 660 ------ .../model/AnalysisBasicInfoOutputBody.java | 180 +- ...tBody.java => AnalysisDataTypesGroup.java} | 98 +- ....java => AnalysisDataTypesOutputBody.java} | 114 +- .../ai/reveng/model/AnalysisLogEntry.java | 351 +++ .../ai/reveng/model/AnalysisRecordBody.java | 180 +- src/main/java/ai/reveng/model/Argument.java | 411 ---- .../java/ai/reveng/model/ArrayDataType.java | 571 +++++ .../java/ai/reveng/model/ArrayDefinition.java | 224 ++ .../java/ai/reveng/model/BaseDataType.java | 540 +++++ .../model/BaseResponseFunctionDataTypes.java | 433 ---- .../BaseResponseFunctionDataTypesList.java | 433 ---- ...BaseResponseGenerateFunctionDataTypes.java | 433 ---- .../BaseResponseGenerationStatusList.java | 433 ---- .../model/BatchFunctionSignatureEntry.java | 530 +++++ .../ai/reveng/model/BitfieldDataType.java | 540 +++++ .../java/ai/reveng/model/ConfigResponse.java | 8 +- ...a => CopyFunctionSignaturesInputBody.java} | 104 +- .../CopyFunctionSignaturesOutputBody.java | 271 +++ .../ai/reveng/model/CopySignatureItem.java | 233 ++ ... => CreateAnalysisDataTypesInputBody.java} | 141 +- .../ai/reveng/model/CreateArrayDataType.java | 376 ++++ ...nArgument.java => CreateBaseDataType.java} | 246 +-- .../reveng/model/CreateBitfieldDataType.java | 347 +++ .../ai/reveng/model/CreateDataTypeEntry.java | 645 ++++++ .../ai/reveng/model/CreateEnumDataType.java | 376 ++++ .../reveng/model/CreateFunctionDataType.java | 376 ++++ .../reveng/model/CreatePointerDataType.java | 376 ++++ .../ai/reveng/model/CreateStructDataType.java | 376 ++++ .../reveng/model/CreateTypedefDataType.java | 376 ++++ .../ai/reveng/model/CreateUnionDataType.java | 376 ++++ .../reveng/model/CreateUnknownDataType.java | 347 +++ .../java/ai/reveng/model/DataTypeEntry.java | 646 ++++++ ...pItem.java => DataTypeEnumValueEntry.java} | 129 +- ...sEntry.java => DataTypeFunctionEntry.java} | 132 +- .../model/DataTypeFunctionParameterEntry.java | 286 +++ ...Variable.java => DataTypeMemberEntry.java} | 254 +-- .../java/ai/reveng/model/DataTypeVersion.java | 266 +++ .../reveng/model/DisassemblyOutputBody.java | 30 +- .../model/DynamicExecutionStatusResponse.java | 2 +- .../java/ai/reveng/model/EnumDataType.java | 571 +++++ .../java/ai/reveng/model/EnumDefinition.java | 226 ++ .../java/ai/reveng/model/Enumeration.java | 395 ---- .../java/ai/reveng/model/FuncDepsInner.java | 360 ---- .../ai/reveng/model/FunctionDataType.java | 571 +++++ .../ai/reveng/model/FunctionDataTypes.java | 384 ---- .../reveng/model/FunctionDataTypesList.java | 359 ---- .../model/FunctionDataTypesListItem.java | 410 ---- .../reveng/model/FunctionDataTypesParams.java | 302 --- .../reveng/model/FunctionDataTypesStatus.java | 341 --- .../ai/reveng/model/FunctionDependency.java | 414 ---- .../java/ai/reveng/model/FunctionHeader.java | 358 ---- .../java/ai/reveng/model/FunctionRename.java | 37 +- .../reveng/model/FunctionSignatureBody.java | 646 ++++++ .../reveng/model/FunctionSignatureEntry.java | 504 +++++ .../model/FunctionSignatureVersion.java | 266 +++ .../java/ai/reveng/model/FunctionType.java | 442 ---- ...nInfo.java => FunctionTypeDefinition.java} | 135 +- .../model/GenerateFunctionDataTypes.java | 354 ---- .../ai/reveng/model/GenerationStatusList.java | 359 ---- ...dy.java => GetAnalysisLogsOutputBody.java} | 104 +- .../reveng/model/GetDataTypeHistoryBody.java | 226 ++ .../GetFunctionSignatureHistoryBody.java | 226 ++ .../ai/reveng/model/GetTokensResponse.java | 306 +++ .../java/ai/reveng/model/GlobalVariable.java | 440 ---- ...seStringMapItem.java => HistoryActor.java} | 118 +- .../ai/reveng/model/LineAttributionsData.java | 216 ++ ...a => ListAnalysisDataTypesOutputBody.java} | 70 +- ...dy.java => ListDataTypeFunctionsBody.java} | 151 +- .../ListFunctionSignaturesOutputBody.java | 287 +++ .../java/ai/reveng/model/MatchFilters.java | 327 ++- .../java/ai/reveng/model/PointerDataType.java | 571 +++++ .../ai/reveng/model/PointerDefinition.java | 198 ++ .../model/RenameUnnamedFunctionsResult.java | 309 +++ .../java/ai/reveng/model/RenderedToken.java | 417 ++++ .../java/ai/reveng/model/ResolvedEntity.java | 1061 +++++++++ .../java/ai/reveng/model/SegmentInfo.java | 37 +- .../reveng/model/SignatureParameterEntry.java | 317 +++ .../reveng/model/SignatureParameterInput.java | 320 +++ .../reveng/model/SignatureStorageEntry.java | 230 ++ .../reveng/model/SignatureStorageInput.java | 230 ++ ...teDataTypesResult.java => StatusBody.java} | 188 +- .../java/ai/reveng/model/StructDataType.java | 652 ++++++ .../ai/reveng/model/StructDefinition.java | 226 ++ src/main/java/ai/reveng/model/Structure.java | 422 ---- .../java/ai/reveng/model/StructureMember.java | 411 ---- .../{ReplacementValue.java => Token.java} | 54 +- .../java/ai/reveng/model/TokenisedData.java | 197 +- ...riggerRenameUnnamedFunctionsInputBody.java | 199 ++ .../java/ai/reveng/model/TypeDefinition.java | 388 ---- .../java/ai/reveng/model/TypedefDataType.java | 571 +++++ .../ai/reveng/model/TypedefDefinition.java | 198 ++ .../java/ai/reveng/model/UnionDataType.java | 571 +++++ .../java/ai/reveng/model/UnionDefinition.java | 226 ++ .../java/ai/reveng/model/UnknownDataType.java | 540 +++++ .../UpdateAnalysisDataTypesInputBody.java | 226 ++ .../ai/reveng/model/UpdateArrayDataType.java | 403 ++++ .../ai/reveng/model/UpdateBaseDataType.java | 374 ++++ .../reveng/model/UpdateBitfieldDataType.java | 374 ++++ .../ai/reveng/model/UpdateDataTypeEntry.java | 645 ++++++ .../ai/reveng/model/UpdateEnumDataType.java | 403 ++++ .../reveng/model/UpdateFunctionDataType.java | 403 ++++ .../UpdateFunctionSignatureInputBody.java | 282 +++ .../reveng/model/UpdatePointerDataType.java | 403 ++++ .../ai/reveng/model/UpdateStructDataType.java | 403 ++++ .../reveng/model/UpdateTypedefDataType.java | 403 ++++ .../ai/reveng/model/UpdateUnionDataType.java | 403 ++++ ...riable.java => UpdateUnknownDataType.java} | 273 +-- .../ai/reveng/model/UpsertOverridesData.java | 41 +- .../model/UpsertOverridesInputBody.java | 13 +- .../ai/reveng/model/V2FunctionHeader.java | 422 ---- .../java/ai/reveng/model/V2FunctionInfo.java | 350 --- .../java/ai/reveng/model/V2FunctionType.java | 506 ----- 263 files changed, 32562 insertions(+), 14864 deletions(-) delete mode 100644 docs/AIDecompFunctionMapping.md delete mode 100644 docs/AIDecompInverseFunctionMapItem.md create mode 100644 docs/AnalysisDataTypesGroup.md create mode 100644 docs/AnalysisDataTypesOutputBody.md create mode 100644 docs/AnalysisLogEntry.md delete mode 100644 docs/Argument.md create mode 100644 docs/ArrayDataType.md create mode 100644 docs/ArrayDefinition.md create mode 100644 docs/BaseDataType.md delete mode 100644 docs/BaseResponseFunctionDataTypes.md delete mode 100644 docs/BaseResponseFunctionDataTypesList.md delete mode 100644 docs/BaseResponseGenerateFunctionDataTypes.md delete mode 100644 docs/BaseResponseGenerationStatusList.md create mode 100644 docs/BatchFunctionSignatureEntry.md delete mode 100644 docs/BatchUpdateDataTypesInputBody.md delete mode 100644 docs/BatchUpdateDataTypesItem.md delete mode 100644 docs/BatchUpdateDataTypesOutputBody.md delete mode 100644 docs/BatchUpdateDataTypesResult.md create mode 100644 docs/BitfieldDataType.md create mode 100644 docs/CopyFunctionSignaturesInputBody.md create mode 100644 docs/CopyFunctionSignaturesOutputBody.md create mode 100644 docs/CopySignatureItem.md create mode 100644 docs/CreateAnalysisDataTypesInputBody.md create mode 100644 docs/CreateArrayDataType.md create mode 100644 docs/CreateBaseDataType.md create mode 100644 docs/CreateBitfieldDataType.md create mode 100644 docs/CreateDataTypeEntry.md create mode 100644 docs/CreateEnumDataType.md create mode 100644 docs/CreateFunctionDataType.md create mode 100644 docs/CreatePointerDataType.md create mode 100644 docs/CreateStructDataType.md create mode 100644 docs/CreateTypedefDataType.md create mode 100644 docs/CreateUnionDataType.md create mode 100644 docs/CreateUnknownDataType.md create mode 100644 docs/DataTypeEntry.md create mode 100644 docs/DataTypeEnumValueEntry.md create mode 100644 docs/DataTypeFunctionEntry.md create mode 100644 docs/DataTypeFunctionParameterEntry.md create mode 100644 docs/DataTypeMemberEntry.md create mode 100644 docs/DataTypeVersion.md create mode 100644 docs/DataTypesApi.md delete mode 100644 docs/DataTypesEntry.md create mode 100644 docs/EnumDataType.md create mode 100644 docs/EnumDefinition.md delete mode 100644 docs/Enumeration.md delete mode 100644 docs/FuncDepsInner.md delete mode 100644 docs/FunctionArgument.md create mode 100644 docs/FunctionDataType.md delete mode 100644 docs/FunctionDataTypes.md delete mode 100644 docs/FunctionDataTypesList.md delete mode 100644 docs/FunctionDataTypesListItem.md delete mode 100644 docs/FunctionDataTypesParams.md delete mode 100644 docs/FunctionDataTypesStatus.md delete mode 100644 docs/FunctionDependency.md delete mode 100644 docs/FunctionHeader.md delete mode 100644 docs/FunctionInfo.md create mode 100644 docs/FunctionSignatureBody.md create mode 100644 docs/FunctionSignatureEntry.md create mode 100644 docs/FunctionSignatureVersion.md delete mode 100644 docs/FunctionStackVariable.md delete mode 100644 docs/FunctionType.md create mode 100644 docs/FunctionTypeDefinition.md delete mode 100644 docs/FunctionsDataTypesApi.md delete mode 100644 docs/GenerateFunctionDataTypes.md delete mode 100644 docs/GenerationStatusList.md create mode 100644 docs/GetAnalysisLogsOutputBody.md create mode 100644 docs/GetDataTypeHistoryBody.md create mode 100644 docs/GetFunctionSignatureHistoryBody.md create mode 100644 docs/GetTokensResponse.md delete mode 100644 docs/GlobalVariable.md create mode 100644 docs/HistoryActor.md create mode 100644 docs/LineAttributionsData.md create mode 100644 docs/ListAnalysisDataTypesOutputBody.md delete mode 100644 docs/ListAnalysisFunctionsDataTypesOutputBody.md create mode 100644 docs/ListDataTypeFunctionsBody.md create mode 100644 docs/ListFunctionSignaturesOutputBody.md create mode 100644 docs/PointerDataType.md rename docs/{ReplacementValue.md => PointerDefinition.md} (56%) create mode 100644 docs/RenameUnnamedFunctionsResult.md create mode 100644 docs/RenderedToken.md create mode 100644 docs/ResolvedEntity.md create mode 100644 docs/SignatureParameterEntry.md create mode 100644 docs/SignatureParameterInput.md create mode 100644 docs/SignatureStorageEntry.md create mode 100644 docs/SignatureStorageInput.md delete mode 100644 docs/StackVariable.md create mode 100644 docs/StatusBody.md create mode 100644 docs/StructDataType.md create mode 100644 docs/StructDefinition.md delete mode 100644 docs/Structure.md delete mode 100644 docs/StructureMember.md rename docs/{ListFunctionsDataTypesOutputBody.md => Token.md} (51%) create mode 100644 docs/TriggerRenameUnnamedFunctionsInputBody.md delete mode 100644 docs/TypeDefinition.md create mode 100644 docs/TypedefDataType.md rename docs/{AIDecompInverseStringMapItem.md => TypedefDefinition.md} (56%) create mode 100644 docs/UnionDataType.md create mode 100644 docs/UnionDefinition.md create mode 100644 docs/UnknownDataType.md create mode 100644 docs/UpdateAnalysisDataTypesInputBody.md create mode 100644 docs/UpdateArrayDataType.md create mode 100644 docs/UpdateBaseDataType.md create mode 100644 docs/UpdateBitfieldDataType.md create mode 100644 docs/UpdateDataTypeEntry.md delete mode 100644 docs/UpdateDataTypesInputBody.md delete mode 100644 docs/UpdateDataTypesOutputBody.md create mode 100644 docs/UpdateEnumDataType.md create mode 100644 docs/UpdateFunctionDataType.md create mode 100644 docs/UpdateFunctionSignatureInputBody.md create mode 100644 docs/UpdatePointerDataType.md create mode 100644 docs/UpdateStructDataType.md create mode 100644 docs/UpdateTypedefDataType.md create mode 100644 docs/UpdateUnionDataType.md create mode 100644 docs/UpdateUnknownDataType.md delete mode 100644 docs/V2FunctionHeader.md delete mode 100644 docs/V2FunctionInfo.md delete mode 100644 docs/V2FunctionType.md create mode 100644 src/main/java/ai/reveng/api/DataTypesApi.java delete mode 100644 src/main/java/ai/reveng/api/FunctionsDataTypesApi.java delete mode 100644 src/main/java/ai/reveng/model/AIDecompFunctionMapping.java rename src/main/java/ai/reveng/model/{ListFunctionsDataTypesOutputBody.java => AnalysisDataTypesGroup.java} (63%) rename src/main/java/ai/reveng/model/{UpdateDataTypesInputBody.java => AnalysisDataTypesOutputBody.java} (61%) create mode 100644 src/main/java/ai/reveng/model/AnalysisLogEntry.java delete mode 100644 src/main/java/ai/reveng/model/Argument.java create mode 100644 src/main/java/ai/reveng/model/ArrayDataType.java create mode 100644 src/main/java/ai/reveng/model/ArrayDefinition.java create mode 100644 src/main/java/ai/reveng/model/BaseDataType.java delete mode 100644 src/main/java/ai/reveng/model/BaseResponseFunctionDataTypes.java delete mode 100644 src/main/java/ai/reveng/model/BaseResponseFunctionDataTypesList.java delete mode 100644 src/main/java/ai/reveng/model/BaseResponseGenerateFunctionDataTypes.java delete mode 100644 src/main/java/ai/reveng/model/BaseResponseGenerationStatusList.java create mode 100644 src/main/java/ai/reveng/model/BatchFunctionSignatureEntry.java create mode 100644 src/main/java/ai/reveng/model/BitfieldDataType.java rename src/main/java/ai/reveng/model/{BatchUpdateDataTypesInputBody.java => CopyFunctionSignaturesInputBody.java} (57%) create mode 100644 src/main/java/ai/reveng/model/CopyFunctionSignaturesOutputBody.java create mode 100644 src/main/java/ai/reveng/model/CopySignatureItem.java rename src/main/java/ai/reveng/model/{BatchUpdateDataTypesItem.java => CreateAnalysisDataTypesInputBody.java} (57%) create mode 100644 src/main/java/ai/reveng/model/CreateArrayDataType.java rename src/main/java/ai/reveng/model/{FunctionArgument.java => CreateBaseDataType.java} (53%) create mode 100644 src/main/java/ai/reveng/model/CreateBitfieldDataType.java create mode 100644 src/main/java/ai/reveng/model/CreateDataTypeEntry.java create mode 100644 src/main/java/ai/reveng/model/CreateEnumDataType.java create mode 100644 src/main/java/ai/reveng/model/CreateFunctionDataType.java create mode 100644 src/main/java/ai/reveng/model/CreatePointerDataType.java create mode 100644 src/main/java/ai/reveng/model/CreateStructDataType.java create mode 100644 src/main/java/ai/reveng/model/CreateTypedefDataType.java create mode 100644 src/main/java/ai/reveng/model/CreateUnionDataType.java create mode 100644 src/main/java/ai/reveng/model/CreateUnknownDataType.java create mode 100644 src/main/java/ai/reveng/model/DataTypeEntry.java rename src/main/java/ai/reveng/model/{AIDecompInverseFunctionMapItem.java => DataTypeEnumValueEntry.java} (60%) rename src/main/java/ai/reveng/model/{DataTypesEntry.java => DataTypeFunctionEntry.java} (59%) create mode 100644 src/main/java/ai/reveng/model/DataTypeFunctionParameterEntry.java rename src/main/java/ai/reveng/model/{StackVariable.java => DataTypeMemberEntry.java} (62%) create mode 100644 src/main/java/ai/reveng/model/DataTypeVersion.java create mode 100644 src/main/java/ai/reveng/model/EnumDataType.java create mode 100644 src/main/java/ai/reveng/model/EnumDefinition.java delete mode 100644 src/main/java/ai/reveng/model/Enumeration.java delete mode 100644 src/main/java/ai/reveng/model/FuncDepsInner.java create mode 100644 src/main/java/ai/reveng/model/FunctionDataType.java delete mode 100644 src/main/java/ai/reveng/model/FunctionDataTypes.java delete mode 100644 src/main/java/ai/reveng/model/FunctionDataTypesList.java delete mode 100644 src/main/java/ai/reveng/model/FunctionDataTypesListItem.java delete mode 100644 src/main/java/ai/reveng/model/FunctionDataTypesParams.java delete mode 100644 src/main/java/ai/reveng/model/FunctionDataTypesStatus.java delete mode 100644 src/main/java/ai/reveng/model/FunctionDependency.java delete mode 100644 src/main/java/ai/reveng/model/FunctionHeader.java create mode 100644 src/main/java/ai/reveng/model/FunctionSignatureBody.java create mode 100644 src/main/java/ai/reveng/model/FunctionSignatureEntry.java create mode 100644 src/main/java/ai/reveng/model/FunctionSignatureVersion.java delete mode 100644 src/main/java/ai/reveng/model/FunctionType.java rename src/main/java/ai/reveng/model/{FunctionInfo.java => FunctionTypeDefinition.java} (53%) delete mode 100644 src/main/java/ai/reveng/model/GenerateFunctionDataTypes.java delete mode 100644 src/main/java/ai/reveng/model/GenerationStatusList.java rename src/main/java/ai/reveng/model/{BatchUpdateDataTypesOutputBody.java => GetAnalysisLogsOutputBody.java} (57%) create mode 100644 src/main/java/ai/reveng/model/GetDataTypeHistoryBody.java create mode 100644 src/main/java/ai/reveng/model/GetFunctionSignatureHistoryBody.java create mode 100644 src/main/java/ai/reveng/model/GetTokensResponse.java delete mode 100644 src/main/java/ai/reveng/model/GlobalVariable.java rename src/main/java/ai/reveng/model/{AIDecompInverseStringMapItem.java => HistoryActor.java} (59%) create mode 100644 src/main/java/ai/reveng/model/LineAttributionsData.java rename src/main/java/ai/reveng/model/{ListAnalysisFunctionsDataTypesOutputBody.java => ListAnalysisDataTypesOutputBody.java} (68%) rename src/main/java/ai/reveng/model/{UpdateDataTypesOutputBody.java => ListDataTypeFunctionsBody.java} (54%) create mode 100644 src/main/java/ai/reveng/model/ListFunctionSignaturesOutputBody.java create mode 100644 src/main/java/ai/reveng/model/PointerDataType.java create mode 100644 src/main/java/ai/reveng/model/PointerDefinition.java create mode 100644 src/main/java/ai/reveng/model/RenameUnnamedFunctionsResult.java create mode 100644 src/main/java/ai/reveng/model/RenderedToken.java create mode 100644 src/main/java/ai/reveng/model/ResolvedEntity.java create mode 100644 src/main/java/ai/reveng/model/SignatureParameterEntry.java create mode 100644 src/main/java/ai/reveng/model/SignatureParameterInput.java create mode 100644 src/main/java/ai/reveng/model/SignatureStorageEntry.java create mode 100644 src/main/java/ai/reveng/model/SignatureStorageInput.java rename src/main/java/ai/reveng/model/{BatchUpdateDataTypesResult.java => StatusBody.java} (57%) create mode 100644 src/main/java/ai/reveng/model/StructDataType.java create mode 100644 src/main/java/ai/reveng/model/StructDefinition.java delete mode 100644 src/main/java/ai/reveng/model/Structure.java delete mode 100644 src/main/java/ai/reveng/model/StructureMember.java rename src/main/java/ai/reveng/model/{ReplacementValue.java => Token.java} (76%) create mode 100644 src/main/java/ai/reveng/model/TriggerRenameUnnamedFunctionsInputBody.java delete mode 100644 src/main/java/ai/reveng/model/TypeDefinition.java create mode 100644 src/main/java/ai/reveng/model/TypedefDataType.java create mode 100644 src/main/java/ai/reveng/model/TypedefDefinition.java create mode 100644 src/main/java/ai/reveng/model/UnionDataType.java create mode 100644 src/main/java/ai/reveng/model/UnionDefinition.java create mode 100644 src/main/java/ai/reveng/model/UnknownDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateAnalysisDataTypesInputBody.java create mode 100644 src/main/java/ai/reveng/model/UpdateArrayDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateBaseDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateBitfieldDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateDataTypeEntry.java create mode 100644 src/main/java/ai/reveng/model/UpdateEnumDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateFunctionDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateFunctionSignatureInputBody.java create mode 100644 src/main/java/ai/reveng/model/UpdatePointerDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateStructDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateTypedefDataType.java create mode 100644 src/main/java/ai/reveng/model/UpdateUnionDataType.java rename src/main/java/ai/reveng/model/{FunctionStackVariable.java => UpdateUnknownDataType.java} (52%) delete mode 100644 src/main/java/ai/reveng/model/V2FunctionHeader.java delete mode 100644 src/main/java/ai/reveng/model/V2FunctionInfo.java delete mode 100644 src/main/java/ai/reveng/model/V2FunctionType.java diff --git a/.sdk-version b/.sdk-version index bb761d25..37c93bef 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.131.1 +v4.4.0 diff --git a/README.md b/README.md index ec72cce9..b049f7e7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add this dependency to your project's POM: ai.reveng sdk - 3.131.1 + 4.4.0 compile ``` @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation "ai.reveng:sdk:3.131.1" + implementation "ai.reveng:sdk:4.4.0" } ``` @@ -88,6 +88,10 @@ Class | Method | HTTP request | Description *AgentApi* | [**getRemediationResultV2AnalysesAnalysisIdAgentRemediationGet**](docs/AgentApi.md#getRemediationResultV2AnalysesAnalysisIdAgentRemediationGet) | **GET** /v2/analyses/{analysis_id}/agent/remediation | Get Remediation Result *AgentApi* | [**getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet**](docs/AgentApi.md#getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result *AgentApi* | [**getTriageResultV2AnalysesAnalysisIdAgentTriageGet**](docs/AgentApi.md#getTriageResultV2AnalysesAnalysisIdAgentTriageGet) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result +*AgentApi* | [**v3CancelRenameUnnamedFunctions**](docs/AgentApi.md#v3CancelRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/cancel | Cancel the rename-unnamed-functions agent. +*AgentApi* | [**v3GetRenameUnnamedFunctionsResult**](docs/AgentApi.md#v3GetRenameUnnamedFunctionsResult) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Get rename-unnamed-functions agent result. +*AgentApi* | [**v3GetRenameUnnamedFunctionsStatus**](docs/AgentApi.md#v3GetRenameUnnamedFunctionsStatus) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status | Get rename-unnamed-functions agent status. +*AgentApi* | [**v3TriggerRenameUnnamedFunctions**](docs/AgentApi.md#v3TriggerRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Run the rename-unnamed-functions agent. *AnalysesBulkActionsApi* | [**bulkAddAnalysisTags**](docs/AnalysesBulkActionsApi.md#bulkAddAnalysisTags) | **PATCH** /v2/analyses/tags/add | Bulk Add Analysis Tags *AnalysesBulkActionsApi* | [**bulkDeleteAnalyses**](docs/AnalysesBulkActionsApi.md#bulkDeleteAnalyses) | **PATCH** /v2/analyses/delete | Bulk Delete Analyses *AnalysesCommentsApi* | [**createAnalysisComment**](docs/AnalysesCommentsApi.md#createAnalysisComment) | **POST** /v2/analyses/{analysis_id}/comments | Create a comment for this analysis @@ -118,6 +122,7 @@ Class | Method | HTTP request | Description *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* | [**v3GetAnalysisAutoUnstripStatus**](docs/AnalysesCoreApi.md#v3GetAnalysisAutoUnstripStatus) | **GET** /v3/analyses/{analysis_id}/auto-unstrip/status | Get the auto-unstrip status for an analysis. +*AnalysesCoreApi* | [**v3GetAnalysisLogs**](docs/AnalysesCoreApi.md#v3GetAnalysisLogs) | **GET** /v3/analyses/{analysis_id}/logs | Get the Analysis log *AnalysesCoreApi* | [**v3GetAnalysisStrings**](docs/AnalysesCoreApi.md#v3GetAnalysisStrings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. *AnalysesCoreApi* | [**v3GetAnalysisStringsStatus**](docs/AnalysesCoreApi.md#v3GetAnalysisStringsStatus) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. *AnalysesCoreApi* | [**v3ListAnalyses**](docs/AnalysesCoreApi.md#v3ListAnalyses) | **GET** /v3/analyses | List analyses @@ -164,6 +169,17 @@ Class | Method | HTTP request | Description *ConversationsApi* | [**listConversations**](docs/ConversationsApi.md#listConversations) | **GET** /v2/conversations | List conversations for the authenticated user *ConversationsApi* | [**sendMessage**](docs/ConversationsApi.md#sendMessage) | **POST** /v2/conversations/{id}/messages | Send a message and start an agentic run *ConversationsApi* | [**streamEvents**](docs/ConversationsApi.md#streamEvents) | **GET** /v2/conversations/{id}/events | Stream conversation events (SSE) +*DataTypesApi* | [**v3CopyFunctionSignatures**](docs/DataTypesApi.md#v3CopyFunctionSignatures) | **POST** /v3/analyses/{analysis_id}/signatures/copy | Copy function signatures +*DataTypesApi* | [**v3CreateAnalysisDataTypes**](docs/DataTypesApi.md#v3CreateAnalysisDataTypes) | **POST** /v3/analyses/{analysis_id}/data-types | Create an analysis's data types +*DataTypesApi* | [**v3GetAnalysisDataType**](docs/DataTypesApi.md#v3GetAnalysisDataType) | **GET** /v3/analyses/{analysis_id}/data-types/{data_type_id} | Get one of an analysis's data types +*DataTypesApi* | [**v3GetAnalysisDataTypeHistory**](docs/DataTypesApi.md#v3GetAnalysisDataTypeHistory) | **GET** /v3/analyses/{analysis_id}/data-types/{data_type_id}/history | Get a data type's edit history +*DataTypesApi* | [**v3GetFunctionSignature**](docs/DataTypesApi.md#v3GetFunctionSignature) | **GET** /v3/analyses/{analysis_id}/functions/{function_id}/signature | Get a function's signature +*DataTypesApi* | [**v3GetFunctionSignatureHistory**](docs/DataTypesApi.md#v3GetFunctionSignatureHistory) | **GET** /v3/analyses/{analysis_id}/functions/{function_id}/signature/history | Get a function signature's edit history +*DataTypesApi* | [**v3ListAnalysisDataTypes**](docs/DataTypesApi.md#v3ListAnalysisDataTypes) | **GET** /v3/analyses/{analysis_id}/data-types | List an analysis's data types +*DataTypesApi* | [**v3ListDataTypeFunctions**](docs/DataTypesApi.md#v3ListDataTypeFunctions) | **GET** /v3/analyses/{analysis_id}/data-types/{data_type_id}/functions | List the functions using a data type +*DataTypesApi* | [**v3ListFunctionSignatures**](docs/DataTypesApi.md#v3ListFunctionSignatures) | **GET** /v3/functions/signatures | Get signatures for many functions +*DataTypesApi* | [**v3UpdateAnalysisDataTypes**](docs/DataTypesApi.md#v3UpdateAnalysisDataTypes) | **PUT** /v3/analyses/{analysis_id}/data-types | Update an analysis's data types +*DataTypesApi* | [**v3UpdateFunctionSignature**](docs/DataTypesApi.md#v3UpdateFunctionSignature) | **PUT** /v3/analyses/{analysis_id}/functions/{function_id}/signature | Update a function's signature *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 @@ -178,13 +194,14 @@ Class | Method | HTTP request | Description *FunctionsAiDecompilationApi* | [**getAiDecompilationStatus**](docs/FunctionsAiDecompilationApi.md#getAiDecompilationStatus) | **GET** /v3/functions/{function_id}/ai-decompilation/status | Get AI decompilation workflow status *FunctionsAiDecompilationApi* | [**getAiDecompilationSummary**](docs/FunctionsAiDecompilationApi.md#getAiDecompilationSummary) | **GET** /v3/functions/{function_id}/ai-decompilation/summary | Get AI decompilation summary *FunctionsAiDecompilationApi* | [**getAiDecompilationSummaryStatus**](docs/FunctionsAiDecompilationApi.md#getAiDecompilationSummaryStatus) | **GET** /v3/functions/{function_id}/ai-decompilation/summary/status | Get summary generation workflow status -*FunctionsAiDecompilationApi* | [**getAiDecompilationTokenised**](docs/FunctionsAiDecompilationApi.md#getAiDecompilationTokenised) | **GET** /v3/functions/{function_id}/ai-decompilation/tokenised | Get tokenised AI decompilation with function mapping *FunctionsAiDecompilationApi* | [**patchAiDecompilationInlineComment**](docs/FunctionsAiDecompilationApi.md#patchAiDecompilationInlineComment) | **PATCH** /v3/functions/{function_id}/ai-decompilation/inline-comments | Update a single inline comment *FunctionsAiDecompilationApi* | [**regenerateAiDecompilationInlineComments**](docs/FunctionsAiDecompilationApi.md#regenerateAiDecompilationInlineComments) | **POST** /v3/functions/{function_id}/ai-decompilation/inline-comments | Regenerate AI decompilation inline comments *FunctionsAiDecompilationApi* | [**regenerateAiDecompilationSummary**](docs/FunctionsAiDecompilationApi.md#regenerateAiDecompilationSummary) | **POST** /v3/functions/{function_id}/ai-decompilation/summary | Regenerate AI decompilation summary *FunctionsAiDecompilationApi* | [**streamAiDecompilation**](docs/FunctionsAiDecompilationApi.md#streamAiDecompilation) | **GET** /v3/functions/{function_id}/ai-decompilation/events | Stream live AI decompilation output (SSE) -*FunctionsAiDecompilationApi* | [**upsertAiDecompilationOverrides**](docs/FunctionsAiDecompilationApi.md#upsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides *FunctionsAiDecompilationApi* | [**upsertAiDecompilationRating**](docs/FunctionsAiDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation +*FunctionsAiDecompilationApi* | [**v3GetAiDecompilationLineAttributions**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationLineAttributions) | **GET** /v3/functions/{function_id}/ai-decompilation/line-attributions | Get AI decompilation line attributions +*FunctionsAiDecompilationApi* | [**v3GetAiDecompilationTokens**](docs/FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides +*FunctionsAiDecompilationApi* | [**v3UpsertAiDecompilationOverrides**](docs/FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides *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 @@ -209,15 +226,6 @@ 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 -*FunctionsDataTypesApi* | [**batchUpdateFunctionDataTypes**](docs/FunctionsDataTypesApi.md#batchUpdateFunctionDataTypes) | **PUT** /v3/analyses/{analysis_id}/functions/data-types | Batch update function data types -*FunctionsDataTypesApi* | [**generateFunctionDataTypesForAnalysis**](docs/FunctionsDataTypesApi.md#generateFunctionDataTypesForAnalysis) | **POST** /v2/analyses/{analysis_id}/functions/data_types | Generate Function Data Types -*FunctionsDataTypesApi* | [**generateFunctionDataTypesForFunctions**](docs/FunctionsDataTypesApi.md#generateFunctionDataTypesForFunctions) | **POST** /v2/functions/data_types | Generate Function Data Types for an arbitrary list of functions -*FunctionsDataTypesApi* | [**getFunctionDataTypes**](docs/FunctionsDataTypesApi.md#getFunctionDataTypes) | **GET** /v3/analyses/{analysis_id}/functions/{function_id}/data-types | Get data types for a single function -*FunctionsDataTypesApi* | [**listAnalysisFunctionsDataTypes**](docs/FunctionsDataTypesApi.md#listAnalysisFunctionsDataTypes) | **GET** /v3/analyses/{analysis_id}/functions/data-types | List data types for all functions in an analysis -*FunctionsDataTypesApi* | [**listFunctionDataTypesForAnalysis**](docs/FunctionsDataTypesApi.md#listFunctionDataTypesForAnalysis) | **GET** /v2/analyses/{analysis_id}/functions/data_types | List Function Data Types -*FunctionsDataTypesApi* | [**listFunctionDataTypesForFunctions**](docs/FunctionsDataTypesApi.md#listFunctionDataTypesForFunctions) | **GET** /v2/functions/data_types | List Function Data Types -*FunctionsDataTypesApi* | [**listFunctionsDataTypes**](docs/FunctionsDataTypesApi.md#listFunctionsDataTypes) | **GET** /v3/functions/data-types | Get data types for many functions -*FunctionsDataTypesApi* | [**updateFunctionDataTypes**](docs/FunctionsDataTypesApi.md#updateFunctionDataTypes) | **PUT** /v2/analyses/{analysis_id}/functions/{function_id}/data_types | Update function data types *FunctionsRenamingHistoryApi* | [**batchRenameFunction**](docs/FunctionsRenamingHistoryApi.md#batchRenameFunction) | **POST** /v2/functions/rename/batch | Batch Rename Functions *FunctionsRenamingHistoryApi* | [**batchRenameFunctions**](docs/FunctionsRenamingHistoryApi.md#batchRenameFunctions) | **POST** /v3/functions/rename | Batch rename functions *FunctionsRenamingHistoryApi* | [**getFunctionHistory**](docs/FunctionsRenamingHistoryApi.md#getFunctionHistory) | **GET** /v3/functions/{function_id}/history | Get function name history @@ -240,9 +248,6 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [AIDecompFunctionMapping](docs/AIDecompFunctionMapping.md) - - [AIDecompInverseFunctionMapItem](docs/AIDecompInverseFunctionMapItem.md) - - [AIDecompInverseStringMapItem](docs/AIDecompInverseStringMapItem.md) - [APIError](docs/APIError.md) - [AddCalleeInputBody](docs/AddCalleeInputBody.md) - [AddCollectionBinariesInputBody](docs/AddCollectionBinariesInputBody.md) @@ -262,11 +267,14 @@ Class | Method | HTTP request | Description - [AnalysisConfigSnapshot](docs/AnalysisConfigSnapshot.md) - [AnalysisCreateRequest](docs/AnalysisCreateRequest.md) - [AnalysisCreateResponse](docs/AnalysisCreateResponse.md) + - [AnalysisDataTypesGroup](docs/AnalysisDataTypesGroup.md) + - [AnalysisDataTypesOutputBody](docs/AnalysisDataTypesOutputBody.md) - [AnalysisDetailResponse](docs/AnalysisDetailResponse.md) - [AnalysisFunctionEntry](docs/AnalysisFunctionEntry.md) - [AnalysisFunctionMapping](docs/AnalysisFunctionMapping.md) - [AnalysisFunctions](docs/AnalysisFunctions.md) - [AnalysisFunctionsList](docs/AnalysisFunctionsList.md) + - [AnalysisLogEntry](docs/AnalysisLogEntry.md) - [AnalysisLogMessage](docs/AnalysisLogMessage.md) - [AnalysisLogs](docs/AnalysisLogs.md) - [AnalysisRecord](docs/AnalysisRecord.md) @@ -291,12 +299,14 @@ Class | Method | HTTP request | Description - [AppApiRestV2FunctionsTypesFunction](docs/AppApiRestV2FunctionsTypesFunction.md) - [AppApiRestV2InfoTypesCapability](docs/AppApiRestV2InfoTypesCapability.md) - [ArchiveContentEntry](docs/ArchiveContentEntry.md) - - [Argument](docs/Argument.md) + - [ArrayDataType](docs/ArrayDataType.md) + - [ArrayDefinition](docs/ArrayDefinition.md) - [Artifact](docs/Artifact.md) - [AttemptFailedEvent](docs/AttemptFailedEvent.md) - [AttemptStartedEvent](docs/AttemptStartedEvent.md) - [AutoRunAgents](docs/AutoRunAgents.md) - [AutoUnstripStatusOutputBody](docs/AutoUnstripStatusOutputBody.md) + - [BaseDataType](docs/BaseDataType.md) - [BaseResponse](docs/BaseResponse.md) - [BaseResponseAdditionalDetailsStatusResponse](docs/BaseResponseAdditionalDetailsStatusResponse.md) - [BaseResponseAnalysisBulkAddTagsResponse](docs/BaseResponseAnalysisBulkAddTagsResponse.md) @@ -331,13 +341,9 @@ Class | Method | HTTP request | Description - [BaseResponseExternalResponse](docs/BaseResponseExternalResponse.md) - [BaseResponseFunctionBlocksResponse](docs/BaseResponseFunctionBlocksResponse.md) - [BaseResponseFunctionCapabilityResponse](docs/BaseResponseFunctionCapabilityResponse.md) - - [BaseResponseFunctionDataTypes](docs/BaseResponseFunctionDataTypes.md) - - [BaseResponseFunctionDataTypesList](docs/BaseResponseFunctionDataTypesList.md) - [BaseResponseFunctionSearchResponse](docs/BaseResponseFunctionSearchResponse.md) - [BaseResponseFunctionStringsResponse](docs/BaseResponseFunctionStringsResponse.md) - [BaseResponseFunctionsDetailResponse](docs/BaseResponseFunctionsDetailResponse.md) - - [BaseResponseGenerateFunctionDataTypes](docs/BaseResponseGenerateFunctionDataTypes.md) - - [BaseResponseGenerationStatusList](docs/BaseResponseGenerationStatusList.md) - [BaseResponseGetPublicUserResponse](docs/BaseResponseGetPublicUserResponse.md) - [BaseResponseListCalleesCallerFunctionsResponse](docs/BaseResponseListCalleesCallerFunctionsResponse.md) - [BaseResponseListCollectionResults](docs/BaseResponseListCollectionResults.md) @@ -363,14 +369,11 @@ Class | Method | HTTP request | Description - [BaseResponseXrefResponse](docs/BaseResponseXrefResponse.md) - [Basic](docs/Basic.md) - [BatchBinaryMatchResult](docs/BatchBinaryMatchResult.md) + - [BatchFunctionSignatureEntry](docs/BatchFunctionSignatureEntry.md) - [BatchMatchingOutputBody](docs/BatchMatchingOutputBody.md) - [BatchRenameInputBody](docs/BatchRenameInputBody.md) - [BatchRenameItem](docs/BatchRenameItem.md) - [BatchRenameOutputBody](docs/BatchRenameOutputBody.md) - - [BatchUpdateDataTypesInputBody](docs/BatchUpdateDataTypesInputBody.md) - - [BatchUpdateDataTypesItem](docs/BatchUpdateDataTypesItem.md) - - [BatchUpdateDataTypesOutputBody](docs/BatchUpdateDataTypesOutputBody.md) - - [BatchUpdateDataTypesResult](docs/BatchUpdateDataTypesResult.md) - [BinariesRelatedStatusResponse](docs/BinariesRelatedStatusResponse.md) - [BinariesTaskStatus](docs/BinariesTaskStatus.md) - [Binary](docs/Binary.md) @@ -382,6 +385,7 @@ Class | Method | HTTP request | Description - [BinarySearchResponse](docs/BinarySearchResponse.md) - [BinarySearchResult](docs/BinarySearchResult.md) - [BinaryTaskStatus](docs/BinaryTaskStatus.md) + - [BitfieldDataType](docs/BitfieldDataType.md) - [BulkCreateUserResult](docs/BulkCreateUserResult.md) - [BulkCreateUsersOutputBody](docs/BulkCreateUsersOutputBody.md) - [BulkDeleteAnalysesRequest](docs/BulkDeleteAnalysesRequest.md) @@ -425,20 +429,40 @@ Class | Method | HTTP request | Description - [Conversation](docs/Conversation.md) - [ConversationContext](docs/ConversationContext.md) - [ConversationWithEvents](docs/ConversationWithEvents.md) + - [CopyFunctionSignaturesInputBody](docs/CopyFunctionSignaturesInputBody.md) + - [CopyFunctionSignaturesOutputBody](docs/CopyFunctionSignaturesOutputBody.md) + - [CopySignatureItem](docs/CopySignatureItem.md) - [CreateAIDecompOutputBody](docs/CreateAIDecompOutputBody.md) + - [CreateAnalysisDataTypesInputBody](docs/CreateAnalysisDataTypesInputBody.md) + - [CreateArrayDataType](docs/CreateArrayDataType.md) + - [CreateBaseDataType](docs/CreateBaseDataType.md) + - [CreateBitfieldDataType](docs/CreateBitfieldDataType.md) - [CreateCheckoutSessionInputBody](docs/CreateCheckoutSessionInputBody.md) - [CreateCollectionInputBody](docs/CreateCollectionInputBody.md) - [CreateCollectionOutputBody](docs/CreateCollectionOutputBody.md) - [CreateConversationRequest](docs/CreateConversationRequest.md) + - [CreateDataTypeEntry](docs/CreateDataTypeEntry.md) + - [CreateEnumDataType](docs/CreateEnumDataType.md) + - [CreateFunctionDataType](docs/CreateFunctionDataType.md) - [CreateGroupInputBody](docs/CreateGroupInputBody.md) - [CreateIdentityInputBody](docs/CreateIdentityInputBody.md) - [CreateIssuerInputBody](docs/CreateIssuerInputBody.md) - [CreateOrganisationInputBody](docs/CreateOrganisationInputBody.md) + - [CreatePointerDataType](docs/CreatePointerDataType.md) - [CreatePortalSessionInputBody](docs/CreatePortalSessionInputBody.md) + - [CreateStructDataType](docs/CreateStructDataType.md) - [CreateTeamInputBody](docs/CreateTeamInputBody.md) + - [CreateTypedefDataType](docs/CreateTypedefDataType.md) + - [CreateUnionDataType](docs/CreateUnionDataType.md) + - [CreateUnknownDataType](docs/CreateUnknownDataType.md) - [CreateUserInputBody](docs/CreateUserInputBody.md) - [Created](docs/Created.md) - - [DataTypesEntry](docs/DataTypesEntry.md) + - [DataTypeEntry](docs/DataTypeEntry.md) + - [DataTypeEnumValueEntry](docs/DataTypeEnumValueEntry.md) + - [DataTypeFunctionEntry](docs/DataTypeFunctionEntry.md) + - [DataTypeFunctionParameterEntry](docs/DataTypeFunctionParameterEntry.md) + - [DataTypeMemberEntry](docs/DataTypeMemberEntry.md) + - [DataTypeVersion](docs/DataTypeVersion.md) - [DecompFailedEvent](docs/DecompFailedEvent.md) - [DecompFinishedEvent](docs/DecompFinishedEvent.md) - [DecompilationCommentContext](docs/DecompilationCommentContext.md) @@ -458,7 +482,8 @@ Class | Method | HTTP request | Description - [ELFSymbol](docs/ELFSymbol.md) - [ElfDynamicEntry](docs/ElfDynamicEntry.md) - [EntrypointModel](docs/EntrypointModel.md) - - [Enumeration](docs/Enumeration.md) + - [EnumDataType](docs/EnumDataType.md) + - [EnumDefinition](docs/EnumDefinition.md) - [ErrorBody](docs/ErrorBody.md) - [ErrorModel](docs/ErrorModel.md) - [Event](docs/Event.md) @@ -498,23 +523,14 @@ Class | Method | HTTP request | Description - [FileMetadata](docs/FileMetadata.md) - [Filters](docs/Filters.md) - [FormFile](docs/FormFile.md) - - [FuncDepsInner](docs/FuncDepsInner.md) - - [FunctionArgument](docs/FunctionArgument.md) - [FunctionBlockDestinationResponse](docs/FunctionBlockDestinationResponse.md) - [FunctionBlockResponse](docs/FunctionBlockResponse.md) - [FunctionBlocksResponse](docs/FunctionBlocksResponse.md) - [FunctionBoundary](docs/FunctionBoundary.md) - [FunctionCallEdges](docs/FunctionCallEdges.md) - [FunctionCapabilityResponse](docs/FunctionCapabilityResponse.md) - - [FunctionDataTypes](docs/FunctionDataTypes.md) - - [FunctionDataTypesList](docs/FunctionDataTypesList.md) - - [FunctionDataTypesListItem](docs/FunctionDataTypesListItem.md) - - [FunctionDataTypesParams](docs/FunctionDataTypesParams.md) - - [FunctionDataTypesStatus](docs/FunctionDataTypesStatus.md) - - [FunctionDependency](docs/FunctionDependency.md) + - [FunctionDataType](docs/FunctionDataType.md) - [FunctionDetailsOutputBody](docs/FunctionDetailsOutputBody.md) - - [FunctionHeader](docs/FunctionHeader.md) - - [FunctionInfo](docs/FunctionInfo.md) - [FunctionListItem](docs/FunctionListItem.md) - [FunctionLocalVariableResponse](docs/FunctionLocalVariableResponse.md) - [FunctionMapping](docs/FunctionMapping.md) @@ -525,28 +541,32 @@ Class | Method | HTTP request | Description - [FunctionRenameMap](docs/FunctionRenameMap.md) - [FunctionSearchResponse](docs/FunctionSearchResponse.md) - [FunctionSearchResult](docs/FunctionSearchResult.md) + - [FunctionSignatureBody](docs/FunctionSignatureBody.md) + - [FunctionSignatureEntry](docs/FunctionSignatureEntry.md) + - [FunctionSignatureVersion](docs/FunctionSignatureVersion.md) - [FunctionSourceType](docs/FunctionSourceType.md) - - [FunctionStackVariable](docs/FunctionStackVariable.md) - [FunctionString](docs/FunctionString.md) - [FunctionStringItem](docs/FunctionStringItem.md) - [FunctionStringsResponse](docs/FunctionStringsResponse.md) - - [FunctionType](docs/FunctionType.md) + - [FunctionTypeDefinition](docs/FunctionTypeDefinition.md) - [FunctionsDetailResponse](docs/FunctionsDetailResponse.md) - [FunctionsListRename](docs/FunctionsListRename.md) - - [GenerateFunctionDataTypes](docs/GenerateFunctionDataTypes.md) - [GeneratePDFOutputBody](docs/GeneratePDFOutputBody.md) - - [GenerationStatusList](docs/GenerationStatusList.md) - [GetAdditionalDetailsOutputBody](docs/GetAdditionalDetailsOutputBody.md) - [GetAdditionalDetailsStatusOutputBody](docs/GetAdditionalDetailsStatusOutputBody.md) - [GetAiDecompilationRatingResponse](docs/GetAiDecompilationRatingResponse.md) + - [GetAnalysisLogsOutputBody](docs/GetAnalysisLogsOutputBody.md) - [GetAnalysisStringsStatusOutputBody](docs/GetAnalysisStringsStatusOutputBody.md) - [GetCollectionOutputBody](docs/GetCollectionOutputBody.md) + - [GetDataTypeHistoryBody](docs/GetDataTypeHistoryBody.md) + - [GetFunctionSignatureHistoryBody](docs/GetFunctionSignatureHistoryBody.md) - [GetMatchesOutputBody](docs/GetMatchesOutputBody.md) - [GetMatchesStatusOutputBody](docs/GetMatchesStatusOutputBody.md) - [GetProductsOutputBody](docs/GetProductsOutputBody.md) - [GetPublicUserResponse](docs/GetPublicUserResponse.md) - [GetSubscriptionOutputBody](docs/GetSubscriptionOutputBody.md) - - [GlobalVariable](docs/GlobalVariable.md) + - [GetTokensResponse](docs/GetTokensResponse.md) + - [HistoryActor](docs/HistoryActor.md) - [HistoryEntry](docs/HistoryEntry.md) - [HttpRequest](docs/HttpRequest.md) - [IOC](docs/IOC.md) @@ -562,16 +582,18 @@ Class | Method | HTTP request | Description - [InsertAnalysisLogRequest](docs/InsertAnalysisLogRequest.md) - [InviteUserInputBody](docs/InviteUserInputBody.md) - [IssuerAllowedDomain](docs/IssuerAllowedDomain.md) + - [LineAttributionsData](docs/LineAttributionsData.md) - [ListAnalysesOutputBody](docs/ListAnalysesOutputBody.md) - - [ListAnalysisFunctionsDataTypesOutputBody](docs/ListAnalysisFunctionsDataTypesOutputBody.md) + - [ListAnalysisDataTypesOutputBody](docs/ListAnalysisDataTypesOutputBody.md) - [ListAnalysisFunctionsOutputBody](docs/ListAnalysisFunctionsOutputBody.md) - [ListAnalysisStringsOutputBody](docs/ListAnalysisStringsOutputBody.md) - [ListArchiveContentsOutputBody](docs/ListArchiveContentsOutputBody.md) - [ListCollectionResults](docs/ListCollectionResults.md) - [ListCollectionsOutputBody](docs/ListCollectionsOutputBody.md) + - [ListDataTypeFunctionsBody](docs/ListDataTypeFunctionsBody.md) - [ListExampleAnalysesOutputBody](docs/ListExampleAnalysesOutputBody.md) + - [ListFunctionSignaturesOutputBody](docs/ListFunctionSignaturesOutputBody.md) - [ListFunctionStringsOutputBody](docs/ListFunctionStringsOutputBody.md) - - [ListFunctionsDataTypesOutputBody](docs/ListFunctionsDataTypesOutputBody.md) - [ListImportedFunctionsOutputBody](docs/ListImportedFunctionsOutputBody.md) - [ListTeamsOutputBody](docs/ListTeamsOutputBody.md) - [ListUsersOutputBody](docs/ListUsersOutputBody.md) @@ -611,6 +633,8 @@ Class | Method | HTTP request | Description - [PcapBodyInfo](docs/PcapBodyInfo.md) - [Permissions](docs/Permissions.md) - [Platform](docs/Platform.md) + - [PointerDataType](docs/PointerDataType.md) + - [PointerDefinition](docs/PointerDefinition.md) - [PriceOutput](docs/PriceOutput.md) - [PriceSummary](docs/PriceSummary.md) - [ProcessActivityEntry](docs/ProcessActivityEntry.md) @@ -635,11 +659,13 @@ Class | Method | HTTP request | Description - [RenameAppliedEvent](docs/RenameAppliedEvent.md) - [RenameInputBody](docs/RenameInputBody.md) - [RenameOutputBody](docs/RenameOutputBody.md) - - [ReplacementValue](docs/ReplacementValue.md) + - [RenameUnnamedFunctionsResult](docs/RenameUnnamedFunctionsResult.md) + - [RenderedToken](docs/RenderedToken.md) - [ReportAnalysisResponse](docs/ReportAnalysisResponse.md) - [ReportEvent](docs/ReportEvent.md) - [ReportInfo](docs/ReportInfo.md) - [ReportOptions](docs/ReportOptions.md) + - [ResolvedEntity](docs/ResolvedEntity.md) - [RevokeBody](docs/RevokeBody.md) - [SSOProvider](docs/SSOProvider.md) - [SSOProvidersOutputBody](docs/SSOProvidersOutputBody.md) @@ -656,6 +682,10 @@ Class | Method | HTTP request | Description - [ServerSentEventsInner1](docs/ServerSentEventsInner1.md) - [ServiceEntry](docs/ServiceEntry.md) - [SessionOutputBody](docs/SessionOutputBody.md) + - [SignatureParameterEntry](docs/SignatureParameterEntry.md) + - [SignatureParameterInput](docs/SignatureParameterInput.md) + - [SignatureStorageEntry](docs/SignatureStorageEntry.md) + - [SignatureStorageInput](docs/SignatureStorageInput.md) - [SingleCodeCertificateModel](docs/SingleCodeCertificateModel.md) - [SingleCodeSignatureModel](docs/SingleCodeSignatureModel.md) - [SinglePDBEntryModel](docs/SinglePDBEntryModel.md) @@ -679,19 +709,19 @@ Class | Method | HTTP request | Description - [SseEventToolCallResultData](docs/SseEventToolCallResultData.md) - [SseEventToolCallStartData](docs/SseEventToolCallStartData.md) - [SseEventToolConfirmationRequiredData](docs/SseEventToolConfirmationRequiredData.md) - - [StackVariable](docs/StackVariable.md) - [StartBatchMatchingInputBody](docs/StartBatchMatchingInputBody.md) - [StartMatchingForAnalysisInputBody](docs/StartMatchingForAnalysisInputBody.md) - [StartMatchingForFunctionsInputBody](docs/StartMatchingForFunctionsInputBody.md) - [StartMatchingOutputBody](docs/StartMatchingOutputBody.md) - [StartupInfo](docs/StartupInfo.md) + - [StatusBody](docs/StatusBody.md) - [StatusInput](docs/StatusInput.md) - [StatusOutput](docs/StatusOutput.md) - [StatusResponse](docs/StatusResponse.md) - [StringFunctions](docs/StringFunctions.md) - [StringSource](docs/StringSource.md) - - [Structure](docs/Structure.md) - - [StructureMember](docs/StructureMember.md) + - [StructDataType](docs/StructDataType.md) + - [StructDefinition](docs/StructDefinition.md) - [SubmitUserFeedbackRequest](docs/SubmitUserFeedbackRequest.md) - [SummaryData](docs/SummaryData.md) - [Symbols](docs/Symbols.md) @@ -707,21 +737,38 @@ Class | Method | HTTP request | Description - [Team](docs/Team.md) - [TeamMember](docs/TeamMember.md) - [TimestampModel](docs/TimestampModel.md) + - [Token](docs/Token.md) - [TokenInputBody](docs/TokenInputBody.md) - [TokenResponse](docs/TokenResponse.md) - [TokenisedData](docs/TokenisedData.md) - [TriageFunctionResponse](docs/TriageFunctionResponse.md) - [TriageReportResponse](docs/TriageReportResponse.md) - [TriggerDynamicExecutionInputBody](docs/TriggerDynamicExecutionInputBody.md) + - [TriggerRenameUnnamedFunctionsInputBody](docs/TriggerRenameUnnamedFunctionsInputBody.md) - [Ttp](docs/Ttp.md) - - [TypeDefinition](docs/TypeDefinition.md) - - [UpdateDataTypesInputBody](docs/UpdateDataTypesInputBody.md) - - [UpdateDataTypesOutputBody](docs/UpdateDataTypesOutputBody.md) + - [TypedefDataType](docs/TypedefDataType.md) + - [TypedefDefinition](docs/TypedefDefinition.md) + - [UnionDataType](docs/UnionDataType.md) + - [UnionDefinition](docs/UnionDefinition.md) + - [UnknownDataType](docs/UnknownDataType.md) + - [UpdateAnalysisDataTypesInputBody](docs/UpdateAnalysisDataTypesInputBody.md) + - [UpdateArrayDataType](docs/UpdateArrayDataType.md) + - [UpdateBaseDataType](docs/UpdateBaseDataType.md) + - [UpdateBitfieldDataType](docs/UpdateBitfieldDataType.md) + - [UpdateDataTypeEntry](docs/UpdateDataTypeEntry.md) + - [UpdateEnumDataType](docs/UpdateEnumDataType.md) + - [UpdateFunctionDataType](docs/UpdateFunctionDataType.md) + - [UpdateFunctionSignatureInputBody](docs/UpdateFunctionSignatureInputBody.md) - [UpdateIssuerInputBody](docs/UpdateIssuerInputBody.md) - [UpdateOrganisationInputBody](docs/UpdateOrganisationInputBody.md) - [UpdatePasswordInputBody](docs/UpdatePasswordInputBody.md) + - [UpdatePointerDataType](docs/UpdatePointerDataType.md) - [UpdateProfileInputBody](docs/UpdateProfileInputBody.md) + - [UpdateStructDataType](docs/UpdateStructDataType.md) - [UpdateTeamInputBody](docs/UpdateTeamInputBody.md) + - [UpdateTypedefDataType](docs/UpdateTypedefDataType.md) + - [UpdateUnionDataType](docs/UpdateUnionDataType.md) + - [UpdateUnknownDataType](docs/UpdateUnknownDataType.md) - [UpdateUserCreditsInputBody](docs/UpdateUserCreditsInputBody.md) - [UpdateUserInputBody](docs/UpdateUserInputBody.md) - [UpdateUserPasswordInputBody](docs/UpdateUserPasswordInputBody.md) @@ -735,9 +782,6 @@ Class | Method | HTTP request | Description - [UserCredits](docs/UserCredits.md) - [UserIdentity](docs/UserIdentity.md) - [UserProfile](docs/UserProfile.md) - - [V2FunctionHeader](docs/V2FunctionHeader.md) - - [V2FunctionInfo](docs/V2FunctionInfo.md) - - [V2FunctionType](docs/V2FunctionType.md) - [WarningEvent](docs/WarningEvent.md) - [WorkflowProgress](docs/WorkflowProgress.md) - [Workspace](docs/Workspace.md) diff --git a/build.gradle b/build.gradle index 1f85130f..21483e40 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ apply plugin: 'java' apply plugin: 'com.diffplug.spotless' group = 'ai.reveng' -version = '3.131.1' +version = '4.4.0' @@ -171,7 +171,7 @@ mavenPublishing { publishToMavenCentral(true) signAllPublications() - coordinates("ai.reveng", "sdk", "3.131.1") + coordinates("ai.reveng", "sdk", "4.4.0") pom { name = "sdk" diff --git a/build.sbt b/build.sbt index cdfcbac7..3b6200e1 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "ai.reveng", name := "sdk", - version := "3.131.1", + version := "4.4.0", scalaVersion := "2.11.12", scalacOptions ++= Seq("-feature"), compile / javacOptions ++= Seq("-Xlint:deprecation"), diff --git a/docs/AIDecompFunctionMapping.md b/docs/AIDecompFunctionMapping.md deleted file mode 100644 index 5852b494..00000000 --- a/docs/AIDecompFunctionMapping.md +++ /dev/null @@ -1,26 +0,0 @@ - - -# AIDecompFunctionMapping - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**fields** | **Map<String, Map<String, ReplacementValue>>** | | | -|**inverseFunctionMap** | [**Map<String, AIDecompInverseFunctionMapItem>**](AIDecompInverseFunctionMapItem.md) | | | -|**inverseStringMap** | [**Map<String, AIDecompInverseStringMapItem>**](AIDecompInverseStringMapItem.md) | | | -|**unmatchedCustomFunctionPointers** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedCustomTypes** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedEnums** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedExternalVars** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedFunctions** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedGlobalVars** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedGoToLabels** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedStrings** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedVariadicLists** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**unmatchedVars** | [**Map<String, ReplacementValue>**](ReplacementValue.md) | | | -|**userOverrideMappings** | **Map<String, String>** | | | - - - diff --git a/docs/AIDecompInverseFunctionMapItem.md b/docs/AIDecompInverseFunctionMapItem.md deleted file mode 100644 index 7cade375..00000000 --- a/docs/AIDecompInverseFunctionMapItem.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# AIDecompInverseFunctionMapItem - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**addr** | **Long** | | | -|**isExternal** | **Boolean** | | | -|**name** | **String** | | | - - - diff --git a/docs/AgentApi.md b/docs/AgentApi.md index ab0b0151..6d604fba 100644 --- a/docs/AgentApi.md +++ b/docs/AgentApi.md @@ -16,6 +16,10 @@ All URIs are relative to *https://api.reveng.ai* | [**getRemediationResultV2AnalysesAnalysisIdAgentRemediationGet**](AgentApi.md#getRemediationResultV2AnalysesAnalysisIdAgentRemediationGet) | **GET** /v2/analyses/{analysis_id}/agent/remediation | Get Remediation Result | | [**getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet**](AgentApi.md#getReportAnalysisResultV2AnalysesAnalysisIdAgentReportAnalysisGet) | **GET** /v2/analyses/{analysis_id}/agent/report-analysis | Get Report Analysis Result | | [**getTriageResultV2AnalysesAnalysisIdAgentTriageGet**](AgentApi.md#getTriageResultV2AnalysesAnalysisIdAgentTriageGet) | **GET** /v2/analyses/{analysis_id}/agent/triage | Get Triage Result | +| [**v3CancelRenameUnnamedFunctions**](AgentApi.md#v3CancelRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/cancel | Cancel the rename-unnamed-functions agent. | +| [**v3GetRenameUnnamedFunctionsResult**](AgentApi.md#v3GetRenameUnnamedFunctionsResult) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Get rename-unnamed-functions agent result. | +| [**v3GetRenameUnnamedFunctionsStatus**](AgentApi.md#v3GetRenameUnnamedFunctionsStatus) | **GET** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions/status | Get rename-unnamed-functions agent status. | +| [**v3TriggerRenameUnnamedFunctions**](AgentApi.md#v3TriggerRenameUnnamedFunctions) | **POST** /v3/analyses/{analysis_id}/agents/rename-unnamed-functions | Run the rename-unnamed-functions agent. | @@ -887,3 +891,314 @@ public class Example { | **200** | Successful Response | - | | **422** | Invalid request parameters | - | + +# **v3CancelRenameUnnamedFunctions** +> v3CancelRenameUnnamedFunctions(analysisId) + +Cancel the rename-unnamed-functions agent. + +Requests cancellation of the currently running rename-unnamed-functions run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + apiInstance.v3CancelRenameUnnamedFunctions(analysisId); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#v3CancelRenameUnnamedFunctions"); + 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 + +null (empty response body) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + + +# **v3GetRenameUnnamedFunctionsResult** +> RenameUnnamedFunctionsResult v3GetRenameUnnamedFunctionsResult(analysisId) + +Get rename-unnamed-functions agent result. + +Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + RenameUnnamedFunctionsResult result = apiInstance.v3GetRenameUnnamedFunctionsResult(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#v3GetRenameUnnamedFunctionsResult"); + 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 + +[**RenameUnnamedFunctionsResult**](RenameUnnamedFunctionsResult.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 | - | + + +# **v3GetRenameUnnamedFunctionsStatus** +> StatusBody v3GetRenameUnnamedFunctionsStatus(analysisId) + +Get rename-unnamed-functions agent status. + +Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + StatusBody result = apiInstance.v3GetRenameUnnamedFunctionsStatus(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#v3GetRenameUnnamedFunctionsStatus"); + 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 + +[**StatusBody**](StatusBody.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 | - | + + +# **v3TriggerRenameUnnamedFunctions** +> StatusBody v3TriggerRenameUnnamedFunctions(analysisId, triggerRenameUnnamedFunctionsInputBody) + +Run the rename-unnamed-functions agent. + +Starts an agent that renames the analysis' unnamed functions from their AI decompilations. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `limit` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + +### 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.AgentApi; + +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"); + + AgentApi apiInstance = new AgentApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + TriggerRenameUnnamedFunctionsInputBody triggerRenameUnnamedFunctionsInputBody = new TriggerRenameUnnamedFunctionsInputBody(); // TriggerRenameUnnamedFunctionsInputBody | + try { + StatusBody result = apiInstance.v3TriggerRenameUnnamedFunctions(analysisId, triggerRenameUnnamedFunctionsInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AgentApi#v3TriggerRenameUnnamedFunctions"); + 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 | | +| **triggerRenameUnnamedFunctionsInputBody** | [**TriggerRenameUnnamedFunctionsInputBody**](TriggerRenameUnnamedFunctionsInputBody.md)| | | + +### Return type + +[**StatusBody**](StatusBody.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 | +|-------------|-------------|------------------| +| **202** | Accepted | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 1fb19253..ea53f1b5 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -28,6 +28,7 @@ All URIs are relative to *https://api.reveng.ai* | [**updateAnalysisTags**](AnalysesCoreApi.md#updateAnalysisTags) | **PATCH** /v2/analyses/{analysis_id}/tags | Update Analysis Tags | | [**uploadFile**](AnalysesCoreApi.md#uploadFile) | **POST** /v2/upload | Upload File | | [**v3GetAnalysisAutoUnstripStatus**](AnalysesCoreApi.md#v3GetAnalysisAutoUnstripStatus) | **GET** /v3/analyses/{analysis_id}/auto-unstrip/status | Get the auto-unstrip status for an analysis. | +| [**v3GetAnalysisLogs**](AnalysesCoreApi.md#v3GetAnalysisLogs) | **GET** /v3/analyses/{analysis_id}/logs | Get the Analysis log | | [**v3GetAnalysisStrings**](AnalysesCoreApi.md#v3GetAnalysisStrings) | **GET** /v3/analyses/{analysis_id}/functions/strings | List strings for an analysis. | | [**v3GetAnalysisStringsStatus**](AnalysesCoreApi.md#v3GetAnalysisStringsStatus) | **GET** /v3/analyses/{analysis_id}/functions/strings/status | Get the string-extraction status for an analysis. | | [**v3ListAnalyses**](AnalysesCoreApi.md#v3ListAnalyses) | **GET** /v3/analyses | List analyses | @@ -1893,6 +1894,83 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | + +# **v3GetAnalysisLogs** +> GetAnalysisLogsOutputBody v3GetAnalysisLogs(analysisId) + +Get the Analysis log + +Returns every log line recorded for the Analysis, oldest first, merged from every source that has written one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.AnalysesCoreApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.reveng.ai"); + + // Configure API key authorization: APIKey + ApiKeyAuth APIKey = (ApiKeyAuth) defaultClient.getAuthentication("APIKey"); + APIKey.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //APIKey.setApiKeyPrefix("Token"); + + // Configure HTTP bearer authorization: bearerAuth + HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth"); + bearerAuth.setBearerToken("BEARER TOKEN"); + + AnalysesCoreApi apiInstance = new AnalysesCoreApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + try { + GetAnalysisLogsOutputBody result = apiInstance.v3GetAnalysisLogs(analysisId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnalysesCoreApi#v3GetAnalysisLogs"); + 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 + +[**GetAnalysisLogsOutputBody**](GetAnalysisLogsOutputBody.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 | - | + # **v3GetAnalysisStrings** > ListAnalysisStringsOutputBody v3GetAnalysisStrings(analysisId, page, pageSize, search, searchOperator, functionSearch, orderBy, sortOrder) diff --git a/docs/AnalysisBasicInfoOutputBody.md b/docs/AnalysisBasicInfoOutputBody.md index 4f1845e6..f65c6410 100644 --- a/docs/AnalysisBasicInfoOutputBody.md +++ b/docs/AnalysisBasicInfoOutputBody.md @@ -15,6 +15,9 @@ |**binaryUuid** | **String** | UUID of the binary, omitted when not set | | |**creation** | **OffsetDateTime** | When the binary was uploaded | | |**debug** | **Boolean** | True when the binary was analysed with debug symbols | | +|**detectedArchitecture** | **String** | Detected instruction-set architecture; empty when unavailable | | +|**detectedBinaryFormat** | **String** | Detected binary container format; empty when unavailable | | +|**detectedBinaryType** | **String** | Detected operating-system platform; empty when unavailable | | |**functionCount** | **Long** | Number of functions in the binary | | |**isAdvanced** | **Boolean** | True when the analysis was run in advanced mode | | |**isOwner** | **Boolean** | True when the caller is the analysis owner | | @@ -24,6 +27,9 @@ |**ownerUsername** | **String** | Username of the analysis owner | | |**sequencerVersion** | **String** | Sequencer version, omitted when not set | [optional] | |**sha256Hash** | **String** | SHA-256 hash of the binary | | +|**suppliedArchitecture** | **String** | User-supplied instruction-set architecture; \"AUTO\" when not overridden | | +|**suppliedBinaryFormat** | **String** | User-supplied binary container format; \"AUTO\" when not overridden | | +|**suppliedBinaryType** | **String** | User-supplied operating-system platform; \"AUTO\" when not overridden | | |**teamId** | **Long** | Team ID of the analysis | | diff --git a/docs/AnalysisDataTypesGroup.md b/docs/AnalysisDataTypesGroup.md new file mode 100644 index 00000000..dcf32acc --- /dev/null +++ b/docs/AnalysisDataTypesGroup.md @@ -0,0 +1,14 @@ + + +# AnalysisDataTypesGroup + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | | | +|**items** | [**List<DataTypeEntry>**](DataTypeEntry.md) | The analysis's types the returned signatures name, ordered by data_type_id. | | + + + diff --git a/docs/AnalysisDataTypesOutputBody.md b/docs/AnalysisDataTypesOutputBody.md new file mode 100644 index 00000000..c584a645 --- /dev/null +++ b/docs/AnalysisDataTypesOutputBody.md @@ -0,0 +1,13 @@ + + +# AnalysisDataTypesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypes** | [**List<DataTypeEntry>**](DataTypeEntry.md) | The stored types, ordered by data_type_id. | | + + + diff --git a/docs/AnalysisLogEntry.md b/docs/AnalysisLogEntry.md new file mode 100644 index 00000000..93fbd179 --- /dev/null +++ b/docs/AnalysisLogEntry.md @@ -0,0 +1,27 @@ + + +# AnalysisLogEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**level** | [**LevelEnum**](#LevelEnum) | Severity | | +|**source** | **String** | Component that emitted the line | | +|**text** | **String** | Log line text | | +|**timestamp** | **OffsetDateTime** | When the line was emitted (UTC) | | + + + +## Enum: LevelEnum + +| Name | Value | +|---- | -----| +| INFO | "INFO" | +| WARN | "WARN" | +| ERROR | "ERROR" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/AnalysisRecordBody.md b/docs/AnalysisRecordBody.md index ced29cc2..951428a7 100644 --- a/docs/AnalysisRecordBody.md +++ b/docs/AnalysisRecordBody.md @@ -14,12 +14,18 @@ |**binaryName** | **String** | Binary filename | | |**binarySize** | **Long** | Binary size in bytes | | |**creation** | **OffsetDateTime** | When the analysis was created | | +|**detectedArchitecture** | **String** | Detected instruction-set architecture; empty when unavailable | | +|**detectedBinaryFormat** | **String** | Detected binary container format; empty when unavailable | | +|**detectedBinaryType** | **String** | Detected operating-system platform; empty when unavailable | | |**functionBoundariesHash** | **String** | Hash of the binary's provided function boundaries | | |**isOwner** | **Boolean** | True when the caller owns the analysis | | |**modelId** | **Long** | Model ID | | |**modelName** | **String** | Model name | | |**sha256Hash** | **String** | SHA-256 hash of the binary | | |**status** | **String** | Analysis status | | +|**suppliedArchitecture** | **String** | User-supplied instruction-set architecture; \"AUTO\" when not overridden | | +|**suppliedBinaryFormat** | **String** | User-supplied binary container format; \"AUTO\" when not overridden | | +|**suppliedBinaryType** | **String** | User-supplied operating-system platform; \"AUTO\" when not overridden | | |**tags** | [**List<AnalysisTagBody>**](AnalysisTagBody.md) | Tags associated with the binary | | |**username** | **String** | Username of the analysis owner | | diff --git a/docs/Argument.md b/docs/Argument.md deleted file mode 100644 index 3e2dcda0..00000000 --- a/docs/Argument.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# Argument - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this argument | [optional] | -|**offset** | **Integer** | Offset of the argument in the function signature | | -|**name** | **String** | Name of the argument | | -|**type** | **String** | Data type of the argument | | -|**size** | **Integer** | Size of the argument in bytes | | - - - diff --git a/docs/ArrayDataType.md b/docs/ArrayDataType.md new file mode 100644 index 00000000..b354b38b --- /dev/null +++ b/docs/ArrayDataType.md @@ -0,0 +1,43 @@ + + +# ArrayDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**ArrayDefinition**](ArrayDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| ARRAY | "ARRAY" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ArrayDefinition.md b/docs/ArrayDefinition.md new file mode 100644 index 00000000..ef5cede3 --- /dev/null +++ b/docs/ArrayDefinition.md @@ -0,0 +1,14 @@ + + +# ArrayDefinition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**count** | **Long** | Element count. Zero is a genuinely empty trailing array; absent means it could not be determined. | [optional] | +|**elementDataTypeId** | **Long** | The element type. | [optional] | + + + diff --git a/docs/BaseDataType.md b/docs/BaseDataType.md new file mode 100644 index 00000000..cce553fe --- /dev/null +++ b/docs/BaseDataType.md @@ -0,0 +1,42 @@ + + +# BaseDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| BASE | "BASE" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/BaseResponseFunctionDataTypes.md b/docs/BaseResponseFunctionDataTypes.md deleted file mode 100644 index 63ad39c1..00000000 --- a/docs/BaseResponseFunctionDataTypes.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# BaseResponseFunctionDataTypes - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**FunctionDataTypes**](FunctionDataTypes.md) | Response data | [optional] | -|**message** | **String** | Response message | [optional] | -|**errors** | [**List<ErrorModel>**](ErrorModel.md) | List of errors | [optional] | -|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | - - - diff --git a/docs/BaseResponseFunctionDataTypesList.md b/docs/BaseResponseFunctionDataTypesList.md deleted file mode 100644 index 6e562b38..00000000 --- a/docs/BaseResponseFunctionDataTypesList.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# BaseResponseFunctionDataTypesList - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**FunctionDataTypesList**](FunctionDataTypesList.md) | Response data | [optional] | -|**message** | **String** | Response message | [optional] | -|**errors** | [**List<ErrorModel>**](ErrorModel.md) | List of errors | [optional] | -|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | - - - diff --git a/docs/BaseResponseGenerateFunctionDataTypes.md b/docs/BaseResponseGenerateFunctionDataTypes.md deleted file mode 100644 index a34b8e7e..00000000 --- a/docs/BaseResponseGenerateFunctionDataTypes.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# BaseResponseGenerateFunctionDataTypes - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**GenerateFunctionDataTypes**](GenerateFunctionDataTypes.md) | Response data | [optional] | -|**message** | **String** | Response message | [optional] | -|**errors** | [**List<ErrorModel>**](ErrorModel.md) | List of errors | [optional] | -|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | - - - diff --git a/docs/BaseResponseGenerationStatusList.md b/docs/BaseResponseGenerationStatusList.md deleted file mode 100644 index 46664809..00000000 --- a/docs/BaseResponseGenerationStatusList.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# BaseResponseGenerationStatusList - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**status** | **Boolean** | Response status on whether the request succeeded | [optional] | -|**data** | [**GenerationStatusList**](GenerationStatusList.md) | Response data | [optional] | -|**message** | **String** | Response message | [optional] | -|**errors** | [**List<ErrorModel>**](ErrorModel.md) | List of errors | [optional] | -|**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] | - - - diff --git a/docs/BatchFunctionSignatureEntry.md b/docs/BatchFunctionSignatureEntry.md new file mode 100644 index 00000000..09eca598 --- /dev/null +++ b/docs/BatchFunctionSignatureEntry.md @@ -0,0 +1,33 @@ + + +# BatchFunctionSignatureEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | The analysis this signature belongs to. Its data_type_ids resolve against this analysis only. | | +|**callingConvention** | **String** | Calling convention, when the producer reported one. | [optional] | +|**createdAt** | **OffsetDateTime** | When this signature was extracted. | [optional] | +|**functionId** | **Long** | | | +|**functionName** | **String** | Current name of the function. | | +|**hasSignature** | **Boolean** | Whether a signature was extracted for this function. False is a normal result: no signature is recorded unless data type extraction ran for the analysis, and thunks and external functions are skipped when it does. | | +|**parameters** | [**List<SignatureParameterEntry>**](SignatureParameterEntry.md) | Parameters in argument order. Empty with has_signature true means the function is known to take no arguments. | | +|**returnDataTypeId** | **Long** | Return type, resolvable against the analysis data types list. Absent for an unresolved return type. | [optional] | +|**sourceFunctionId** | **Long** | The function this signature was copied from, when it was transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this signature came from. | [optional] | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/BatchUpdateDataTypesInputBody.md b/docs/BatchUpdateDataTypesInputBody.md deleted file mode 100644 index 54bdacfc..00000000 --- a/docs/BatchUpdateDataTypesInputBody.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# BatchUpdateDataTypesInputBody - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**functions** | [**List<BatchUpdateDataTypesItem>**](BatchUpdateDataTypesItem.md) | List of functions to update. All function IDs must belong to the analysis in the URL. | | - - - diff --git a/docs/BatchUpdateDataTypesItem.md b/docs/BatchUpdateDataTypesItem.md deleted file mode 100644 index c252fbc8..00000000 --- a/docs/BatchUpdateDataTypesItem.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# BatchUpdateDataTypesItem - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**dataTypes** | **Object** | | | -|**dataTypesVersion** | **Long** | Current stored version. Pass 0 on the first write. | | -|**functionId** | **Long** | Function ID | | - - - diff --git a/docs/BatchUpdateDataTypesOutputBody.md b/docs/BatchUpdateDataTypesOutputBody.md deleted file mode 100644 index 433856a7..00000000 --- a/docs/BatchUpdateDataTypesOutputBody.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# BatchUpdateDataTypesOutputBody - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**results** | [**List<BatchUpdateDataTypesResult>**](BatchUpdateDataTypesResult.md) | Per-function outcomes in the same order as the input | | - - - diff --git a/docs/BatchUpdateDataTypesResult.md b/docs/BatchUpdateDataTypesResult.md deleted file mode 100644 index 4f0c46d2..00000000 --- a/docs/BatchUpdateDataTypesResult.md +++ /dev/null @@ -1,28 +0,0 @@ - - -# BatchUpdateDataTypesResult - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**dataTypes** | **Object** | | [optional] | -|**dataTypesVersion** | **Long** | Version after update (present when status is 'updated') | [optional] | -|**error** | **String** | Error message (present when status is 'error') | [optional] | -|**functionId** | **Long** | Function ID | | -|**status** | [**StatusEnum**](#StatusEnum) | Outcome for this function | | - - - -## Enum: StatusEnum - -| Name | Value | -|---- | -----| -| UPDATED | "updated" | -| VERSION_CONFLICT | "version_conflict" | -| ERROR | "error" | -| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | - - - diff --git a/docs/BitfieldDataType.md b/docs/BitfieldDataType.md new file mode 100644 index 00000000..19d9cc3a --- /dev/null +++ b/docs/BitfieldDataType.md @@ -0,0 +1,42 @@ + + +# BitfieldDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| BITFIELD | "BITFIELD" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CollectionsApi.md b/docs/CollectionsApi.md index c2d7b8e8..b09184e5 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -726,7 +726,7 @@ public class Example { Delete a collection. -Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict +Deletes a collection along with its binary links, tags, and hierarchy links. The binaries themselves are not deleted. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied ### Example ```java @@ -793,7 +793,6 @@ null (empty response body) | **204** | No Content | - | | **403** | Forbidden | - | | **404** | Not Found | - | -| **409** | Conflict | - | | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | diff --git a/docs/ConfigResponse.md b/docs/ConfigResponse.md index 04f9cb3b..658e00ca 100644 --- a/docs/ConfigResponse.md +++ b/docs/ConfigResponse.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**dashboardUrl** | **String** | The domain of the RevEng.AI platform you are connected to | [optional] | -|**maxFileSizeBytes** | **Integer** | Maximum file size (in bytes) that can be uploaded for analysis | | +|**maxFileSizeBytes** | **Long** | Maximum file size (in bytes) that can be uploaded for analysis | | |**aiDecompilerUnsupportedLanguages** | **List<String>** | List of programming languages that are not supported for AI decompilation | | |**aiDecompilerSupportedModels** | **List<String>** | List of models that support AI decompilation | | diff --git a/docs/CopyFunctionSignaturesInputBody.md b/docs/CopyFunctionSignaturesInputBody.md new file mode 100644 index 00000000..ffc4e012 --- /dev/null +++ b/docs/CopyFunctionSignaturesInputBody.md @@ -0,0 +1,13 @@ + + +# CopyFunctionSignaturesInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**copies** | [**List<CopySignatureItem>**](CopySignatureItem.md) | Signatures to copy. No target may repeat, and no pair may name the same function twice. | | + + + diff --git a/docs/CopyFunctionSignaturesOutputBody.md b/docs/CopyFunctionSignaturesOutputBody.md new file mode 100644 index 00000000..b908b665 --- /dev/null +++ b/docs/CopyFunctionSignaturesOutputBody.md @@ -0,0 +1,14 @@ + + +# CopyFunctionSignaturesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypes** | [**List<DataTypeEntry>**](DataTypeEntry.md) | The data types this analysis gained or had replaced, ordered by data_type_id. Empty when every type the copied signatures need was already stored unchanged. | | +|**signatures** | [**List<FunctionSignatureEntry>**](FunctionSignatureEntry.md) | The stored signatures of the target functions, in request order. | | + + + diff --git a/docs/CopySignatureItem.md b/docs/CopySignatureItem.md new file mode 100644 index 00000000..8f6a2b06 --- /dev/null +++ b/docs/CopySignatureItem.md @@ -0,0 +1,14 @@ + + +# CopySignatureItem + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**sourceFunctionId** | **Long** | Function to copy the signature from. May belong to another analysis the caller can read. | | +|**targetFunctionId** | **Long** | Function to copy the signature to. Must belong to the analysis in the URL. | | + + + diff --git a/docs/CreateAnalysisDataTypesInputBody.md b/docs/CreateAnalysisDataTypesInputBody.md new file mode 100644 index 00000000..d628c4c2 --- /dev/null +++ b/docs/CreateAnalysisDataTypesInputBody.md @@ -0,0 +1,13 @@ + + +# CreateAnalysisDataTypesInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypes** | [**List<CreateDataTypeEntry>**](CreateDataTypeEntry.md) | The types to create. Each namespace, name and kind must be new to the analysis. | | + + + diff --git a/docs/CreateArrayDataType.md b/docs/CreateArrayDataType.md new file mode 100644 index 00000000..1d3b244f --- /dev/null +++ b/docs/CreateArrayDataType.md @@ -0,0 +1,26 @@ + + +# CreateArrayDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**ArrayDefinition**](ArrayDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| ARRAY | "ARRAY" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateBaseDataType.md b/docs/CreateBaseDataType.md new file mode 100644 index 00000000..b58cbd71 --- /dev/null +++ b/docs/CreateBaseDataType.md @@ -0,0 +1,25 @@ + + +# CreateBaseDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| BASE | "BASE" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateBitfieldDataType.md b/docs/CreateBitfieldDataType.md new file mode 100644 index 00000000..42064e12 --- /dev/null +++ b/docs/CreateBitfieldDataType.md @@ -0,0 +1,25 @@ + + +# CreateBitfieldDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| BITFIELD | "BITFIELD" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateDataTypeEntry.md b/docs/CreateDataTypeEntry.md new file mode 100644 index 00000000..9af0dd00 --- /dev/null +++ b/docs/CreateDataTypeEntry.md @@ -0,0 +1,27 @@ + + +# CreateDataTypeEntry + +A data type to create. `kind` selects the variant and so which definition the type must carry. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**FunctionTypeDefinition**](FunctionTypeDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNKNOWN | "UNKNOWN" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateEnumDataType.md b/docs/CreateEnumDataType.md new file mode 100644 index 00000000..255cdfbf --- /dev/null +++ b/docs/CreateEnumDataType.md @@ -0,0 +1,26 @@ + + +# CreateEnumDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**EnumDefinition**](EnumDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| ENUM | "ENUM" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateFunctionDataType.md b/docs/CreateFunctionDataType.md new file mode 100644 index 00000000..efa478e1 --- /dev/null +++ b/docs/CreateFunctionDataType.md @@ -0,0 +1,26 @@ + + +# CreateFunctionDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**FunctionTypeDefinition**](FunctionTypeDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| FUNCTION_DEFINITION | "FUNCTION_DEFINITION" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreatePointerDataType.md b/docs/CreatePointerDataType.md new file mode 100644 index 00000000..67b32992 --- /dev/null +++ b/docs/CreatePointerDataType.md @@ -0,0 +1,26 @@ + + +# CreatePointerDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**PointerDefinition**](PointerDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| POINTER | "POINTER" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateStructDataType.md b/docs/CreateStructDataType.md new file mode 100644 index 00000000..43cfe4ed --- /dev/null +++ b/docs/CreateStructDataType.md @@ -0,0 +1,26 @@ + + +# CreateStructDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**StructDefinition**](StructDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| STRUCT | "STRUCT" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateTypedefDataType.md b/docs/CreateTypedefDataType.md new file mode 100644 index 00000000..4ed58d79 --- /dev/null +++ b/docs/CreateTypedefDataType.md @@ -0,0 +1,26 @@ + + +# CreateTypedefDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**TypedefDefinition**](TypedefDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| TYPEDEF | "TYPEDEF" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateUnionDataType.md b/docs/CreateUnionDataType.md new file mode 100644 index 00000000..57e41415 --- /dev/null +++ b/docs/CreateUnionDataType.md @@ -0,0 +1,26 @@ + + +# CreateUnionDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**definition** | [**UnionDefinition**](UnionDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNION | "UNION" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/CreateUnknownDataType.md b/docs/CreateUnknownDataType.md new file mode 100644 index 00000000..b9513cc5 --- /dev/null +++ b/docs/CreateUnknownDataType.md @@ -0,0 +1,25 @@ + + +# CreateUnknownDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNKNOWN | "UNKNOWN" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/DataTypeEntry.md b/docs/DataTypeEntry.md new file mode 100644 index 00000000..eb591fba --- /dev/null +++ b/docs/DataTypeEntry.md @@ -0,0 +1,44 @@ + + +# DataTypeEntry + +A data type extracted from the binary. `kind` selects the variant and so which definition the type carries. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**FunctionTypeDefinition**](FunctionTypeDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNKNOWN | "UNKNOWN" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/DataTypeEnumValueEntry.md b/docs/DataTypeEnumValueEntry.md new file mode 100644 index 00000000..3f8fad37 --- /dev/null +++ b/docs/DataTypeEnumValueEntry.md @@ -0,0 +1,14 @@ + + +# DataTypeEnumValueEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**name** | **String** | Constant name. | | +|**value** | **String** | Constant value, a decimal integer as a string, with no leading zeros. A string because the value may be negative or exceed 64 unsigned bits, which a JSON number cannot carry safely. | | + + + diff --git a/docs/DataTypeFunctionEntry.md b/docs/DataTypeFunctionEntry.md new file mode 100644 index 00000000..69b9e31e --- /dev/null +++ b/docs/DataTypeFunctionEntry.md @@ -0,0 +1,14 @@ + + +# DataTypeFunctionEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**functionId** | **Long** | | | +|**functionName** | **String** | Current name of the function. | | + + + diff --git a/docs/DataTypeFunctionParameterEntry.md b/docs/DataTypeFunctionParameterEntry.md new file mode 100644 index 00000000..b896de04 --- /dev/null +++ b/docs/DataTypeFunctionParameterEntry.md @@ -0,0 +1,16 @@ + + +# DataTypeFunctionParameterEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The parameter's type. | [optional] | +|**name** | **String** | Parameter name, when the producer had one. | [optional] | +|**ordinal** | **Long** | Zero-based argument position. | | +|**size** | **Long** | Parameter size in bytes. | | + + + diff --git a/docs/DataTypeMemberEntry.md b/docs/DataTypeMemberEntry.md new file mode 100644 index 00000000..5a95ddee --- /dev/null +++ b/docs/DataTypeMemberEntry.md @@ -0,0 +1,19 @@ + + +# DataTypeMemberEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bitOffset** | **Long** | Bit offset from the start of the containing type, for bitfields. | [optional] | +|**bitSize** | **Long** | Width in bits, for bitfields. | [optional] | +|**dataTypeId** | **Long** | The member's type. | [optional] | +|**isBitfield** | **Boolean** | Whether this member is a bitfield. | | +|**name** | **String** | Member name, absent for unnamed padding. | [optional] | +|**offset** | **Long** | Byte offset from the start of the containing type. | | +|**size** | **Long** | Member size in bytes. | | + + + diff --git a/docs/DataTypeVersion.md b/docs/DataTypeVersion.md new file mode 100644 index 00000000..98ebbe6a --- /dev/null +++ b/docs/DataTypeVersion.md @@ -0,0 +1,15 @@ + + +# DataTypeVersion + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**updatedAt** | **OffsetDateTime** | When this version was written. Absent on a version that predates the recorded history. | [optional] | +|**updatedBy** | [**HistoryActor**](HistoryActor.md) | Who wrote this version. Absent on a version that predates the recorded history. | [optional] | +|**value** | [**DataTypeEntry**](DataTypeEntry.md) | The type as it stood in this version. | | + + + diff --git a/docs/DataTypesApi.md b/docs/DataTypesApi.md new file mode 100644 index 00000000..a9e1c1ad --- /dev/null +++ b/docs/DataTypesApi.md @@ -0,0 +1,917 @@ +# DataTypesApi + +All URIs are relative to *https://api.reveng.ai* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**v3CopyFunctionSignatures**](DataTypesApi.md#v3CopyFunctionSignatures) | **POST** /v3/analyses/{analysis_id}/signatures/copy | Copy function signatures | +| [**v3CreateAnalysisDataTypes**](DataTypesApi.md#v3CreateAnalysisDataTypes) | **POST** /v3/analyses/{analysis_id}/data-types | Create an analysis's data types | +| [**v3GetAnalysisDataType**](DataTypesApi.md#v3GetAnalysisDataType) | **GET** /v3/analyses/{analysis_id}/data-types/{data_type_id} | Get one of an analysis's data types | +| [**v3GetAnalysisDataTypeHistory**](DataTypesApi.md#v3GetAnalysisDataTypeHistory) | **GET** /v3/analyses/{analysis_id}/data-types/{data_type_id}/history | Get a data type's edit history | +| [**v3GetFunctionSignature**](DataTypesApi.md#v3GetFunctionSignature) | **GET** /v3/analyses/{analysis_id}/functions/{function_id}/signature | Get a function's signature | +| [**v3GetFunctionSignatureHistory**](DataTypesApi.md#v3GetFunctionSignatureHistory) | **GET** /v3/analyses/{analysis_id}/functions/{function_id}/signature/history | Get a function signature's edit history | +| [**v3ListAnalysisDataTypes**](DataTypesApi.md#v3ListAnalysisDataTypes) | **GET** /v3/analyses/{analysis_id}/data-types | List an analysis's data types | +| [**v3ListDataTypeFunctions**](DataTypesApi.md#v3ListDataTypeFunctions) | **GET** /v3/analyses/{analysis_id}/data-types/{data_type_id}/functions | List the functions using a data type | +| [**v3ListFunctionSignatures**](DataTypesApi.md#v3ListFunctionSignatures) | **GET** /v3/functions/signatures | Get signatures for many functions | +| [**v3UpdateAnalysisDataTypes**](DataTypesApi.md#v3UpdateAnalysisDataTypes) | **PUT** /v3/analyses/{analysis_id}/data-types | Update an analysis's data types | +| [**v3UpdateFunctionSignature**](DataTypesApi.md#v3UpdateFunctionSignature) | **PUT** /v3/analyses/{analysis_id}/functions/{function_id}/signature | Update a function's signature | + + + +# **v3CopyFunctionSignatures** +> CopyFunctionSignaturesOutputBody v3CopyFunctionSignatures(analysisId, copyFunctionSignaturesInputBody) + +Copy function signatures + +Replaces each target function's signature with a copy of its source's parameters, return type and calling convention. Every target must belong to this analysis; a source may belong to any analysis the caller can read. The whole request is rejected if any pair is invalid. A `data_type_id` means nothing outside the analysis that issued it, so the types a copied signature needs are resolved against this analysis by namespace, name and kind. A type this analysis already has under that key has its definition replaced by the source's; a type it lacks is created. Copied signatures get a `source_type` of `USER` and a `source_function_id`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### 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.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + CopyFunctionSignaturesInputBody copyFunctionSignaturesInputBody = new CopyFunctionSignaturesInputBody(); // CopyFunctionSignaturesInputBody | + try { + CopyFunctionSignaturesOutputBody result = apiInstance.v3CopyFunctionSignatures(analysisId, copyFunctionSignaturesInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3CopyFunctionSignatures"); + 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 | | +| **copyFunctionSignaturesInputBody** | [**CopyFunctionSignaturesInputBody**](CopyFunctionSignaturesInputBody.md)| | | + +### Return type + +[**CopyFunctionSignaturesOutputBody**](CopyFunctionSignaturesOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + + +# **v3CreateAnalysisDataTypes** +> AnalysisDataTypesOutputBody v3CreateAnalysisDataTypes(analysisId, createAnalysisDataTypesInputBody) + +Create an analysis's data types + +Adds user-authored types to an analysis. Many types can be created in one request; the whole request is rejected if any of them is invalid. Ids are assigned by the server and returned here. Stored types get a `source_type` of `USER`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### 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.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + CreateAnalysisDataTypesInputBody createAnalysisDataTypesInputBody = new CreateAnalysisDataTypesInputBody(); // CreateAnalysisDataTypesInputBody | + try { + AnalysisDataTypesOutputBody result = apiInstance.v3CreateAnalysisDataTypes(analysisId, createAnalysisDataTypesInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3CreateAnalysisDataTypes"); + 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 | | +| **createAnalysisDataTypesInputBody** | [**CreateAnalysisDataTypesInputBody**](CreateAnalysisDataTypesInputBody.md)| | | + +### Return type + +[**AnalysisDataTypesOutputBody**](AnalysisDataTypesOutputBody.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 | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + + +# **v3GetAnalysisDataType** +> DataTypeEntry v3GetAnalysisDataType(analysisId, dataTypeId) + +Get one of an analysis's data types + +Returns a single data type by its `data_type_id`, byte-identical to the entry the data types list returns for it — same variant, same fields, same definition — so a client can cache and invalidate rows from either endpoint interchangeably. **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.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long dataTypeId = 56L; // Long | Data type ID, as returned by the data types list for this analysis. 0 is a valid id. + try { + DataTypeEntry result = apiInstance.v3GetAnalysisDataType(analysisId, dataTypeId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3GetAnalysisDataType"); + 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 | | +| **dataTypeId** | **Long**| Data type ID, as returned by the data types list for this analysis. 0 is a valid id. | | + +### Return type + +[**DataTypeEntry**](DataTypeEntry.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 | - | + + +# **v3GetAnalysisDataTypeHistory** +> GetDataTypeHistoryBody v3GetAnalysisDataTypeHistory(analysisId, dataTypeId) + +Get a data type's edit history + +The versions a data type has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **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.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long dataTypeId = 56L; // Long | Data type ID, as returned by the data types list for this analysis. 0 is a valid id. + try { + GetDataTypeHistoryBody result = apiInstance.v3GetAnalysisDataTypeHistory(analysisId, dataTypeId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3GetAnalysisDataTypeHistory"); + 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 | | +| **dataTypeId** | **Long**| Data type ID, as returned by the data types list for this analysis. 0 is a valid id. | | + +### Return type + +[**GetDataTypeHistoryBody**](GetDataTypeHistoryBody.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 | - | + + +# **v3GetFunctionSignature** +> FunctionSignatureBody v3GetFunctionSignature(analysisId, functionId, includeDataTypes) + +Get a function's signature + +Returns the extracted signature for one function: its parameters, return type and calling convention. Pass `include_data_types=true` to also get the data types it names. **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.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long functionId = 56L; // Long | Function ID + Boolean includeDataTypes = true; // Boolean | Include the data types the signature names in the response. + try { + FunctionSignatureBody result = apiInstance.v3GetFunctionSignature(analysisId, functionId, includeDataTypes); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3GetFunctionSignature"); + 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 | | +| **functionId** | **Long**| Function ID | | +| **includeDataTypes** | **Boolean**| Include the data types the signature names in the response. | [optional] | + +### Return type + +[**FunctionSignatureBody**](FunctionSignatureBody.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 | - | + + +# **v3GetFunctionSignatureHistory** +> GetFunctionSignatureHistoryBody v3GetFunctionSignatureHistory(analysisId, functionId) + +Get a function signature's edit history + +The versions a function's signature has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **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.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long functionId = 56L; // Long | Function ID + try { + GetFunctionSignatureHistoryBody result = apiInstance.v3GetFunctionSignatureHistory(analysisId, functionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3GetFunctionSignatureHistory"); + 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 | | +| **functionId** | **Long**| Function ID | | + +### Return type + +[**GetFunctionSignatureHistoryBody**](GetFunctionSignatureHistoryBody.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 | - | + + +# **v3ListAnalysisDataTypes** +> ListAnalysisDataTypesOutputBody v3ListAnalysisDataTypes(analysisId, offset, limit, kind, namespace, search, sourceType, orderBy, order) + +List an analysis's data types + +Paginated, filterable list of the data types extracted from the binary — structs, unions, enums, typedefs and the rest. Every entry carries its full definition, so paging this list once resolves every `data_type_id` a definition or signature refers to; no follow-up request per id is needed. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long offset = 0L; // Long | Pagination offset. + Long limit = 100L; // Long | Page size. + List kind = Arrays.asList(); // List | Only return types of these kinds. Repeat for more than one; empty means no filter. + List namespace = Arrays.asList(); // List | Only return types in these namespaces, matched exactly. Omit for no filter; pass an empty value (namespace=) for the binary's own types, which have no namespace. + String search = "search_example"; // String | Only return types whose name contains this term. Wildcards in the term are matched literally. + List sourceType = Arrays.asList(); // List | Only return types from these sources. Empty means no filter. + String orderBy = "name"; // String | Field to order by. name orders by namespace, then name, then kind; size orders by size with types of unknown size last, then by namespace, name and kind. + String order = "ASC"; // String | Sort direction. + try { + ListAnalysisDataTypesOutputBody result = apiInstance.v3ListAnalysisDataTypes(analysisId, offset, limit, kind, namespace, search, sourceType, orderBy, order); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3ListAnalysisDataTypes"); + 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 | | +| **offset** | **Long**| Pagination offset. | [optional] [default to 0] | +| **limit** | **Long**| Page size. | [optional] [default to 100] | +| **kind** | [**List<String>**](String.md)| Only return types of these kinds. Repeat for more than one; empty means no filter. | [optional] [enum: STRUCT, UNION, ENUM, TYPEDEF, POINTER, ARRAY, FUNCTION_DEFINITION, BITFIELD, BASE, UNKNOWN] | +| **namespace** | [**List<String>**](String.md)| Only return types in these namespaces, matched exactly. Omit for no filter; pass an empty value (namespace=) for the binary's own types, which have no namespace. | [optional] | +| **search** | **String**| Only return types whose name contains this term. Wildcards in the term are matched literally. | [optional] | +| **sourceType** | [**List<String>**](String.md)| Only return types from these sources. Empty means no filter. | [optional] [enum: SYSTEM, USER, AUTO_UNSTRIP, AI_DECOMP] | +| **orderBy** | **String**| Field to order by. name orders by namespace, then name, then kind; size orders by size with types of unknown size last, then by namespace, name and kind. | [optional] [default to name] [enum: name, size] | +| **order** | **String**| Sort direction. | [optional] [default to ASC] [enum: ASC, DESC] | + +### Return type + +[**ListAnalysisDataTypesOutputBody**](ListAnalysisDataTypesOutputBody.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 | - | + + +# **v3ListDataTypeFunctions** +> ListDataTypeFunctionsBody v3ListDataTypeFunctions(analysisId, dataTypeId, pageSize, afterFunctionId) + +List the functions using a data type + +Functions that use this data type as their return type or as a parameter. Matches the `data_type_id` exactly as it appears in the signature, so a function taking `sockaddr_in *` matches the pointer type rather than `sockaddr_in`. Ordered by function ID. There is no total count; page with `after_function_id`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long dataTypeId = 56L; // Long | Data type ID, as returned by the data types list for this analysis. 0 is a valid id. + Long pageSize = 50L; // Long | Page size. + Long afterFunctionId = 0L; // Long | Return functions with an ID greater than this. Pass the previous page's next_after_function_id; 0 starts at the first function. + try { + ListDataTypeFunctionsBody result = apiInstance.v3ListDataTypeFunctions(analysisId, dataTypeId, pageSize, afterFunctionId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3ListDataTypeFunctions"); + 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 | | +| **dataTypeId** | **Long**| Data type ID, as returned by the data types list for this analysis. 0 is a valid id. | | +| **pageSize** | **Long**| Page size. | [optional] [default to 50] | +| **afterFunctionId** | **Long**| Return functions with an ID greater than this. Pass the previous page's next_after_function_id; 0 starts at the first function. | [optional] [default to 0] | + +### Return type + +[**ListDataTypeFunctionsBody**](ListDataTypeFunctionsBody.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 | - | + + +# **v3ListFunctionSignatures** +> ListFunctionSignaturesOutputBody v3ListFunctionSignatures(functionIds, includeDataTypes) + +Get signatures for many functions + +Returns the extracted signature for each supplied function ID, in request order. The functions need not share an analysis; each entry names the analysis its `data_type_id`s resolve against. Pass `include_data_types=true` to also get those data types, grouped by analysis. The caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + List functionIds = Arrays.asList(); // List | Function IDs to fetch signatures for. + Boolean includeDataTypes = true; // Boolean | Include the data types the signatures name in the response. + try { + ListFunctionSignaturesOutputBody result = apiInstance.v3ListFunctionSignatures(functionIds, includeDataTypes); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3ListFunctionSignatures"); + 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 | +|------------- | ------------- | ------------- | -------------| +| **functionIds** | [**List<Long>**](Long.md)| Function IDs to fetch signatures for. | | +| **includeDataTypes** | **Boolean**| Include the data types the signatures name in the response. | [optional] | + +### Return type + +[**ListFunctionSignaturesOutputBody**](ListFunctionSignaturesOutputBody.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 | - | + + +# **v3UpdateAnalysisDataTypes** +> AnalysisDataTypesOutputBody v3UpdateAnalysisDataTypes(analysisId, updateAnalysisDataTypesInputBody) + +Update an analysis's data types + +Replaces stored types in full: a field left out of the request is cleared. Many types can be updated in one request; the whole request is rejected if any of them is invalid. `kind` may be changed, and the definition must then match the new kind. Updated types get a `source_type` of `USER`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### 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.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + UpdateAnalysisDataTypesInputBody updateAnalysisDataTypesInputBody = new UpdateAnalysisDataTypesInputBody(); // UpdateAnalysisDataTypesInputBody | + try { + AnalysisDataTypesOutputBody result = apiInstance.v3UpdateAnalysisDataTypes(analysisId, updateAnalysisDataTypesInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3UpdateAnalysisDataTypes"); + 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 | | +| **updateAnalysisDataTypesInputBody** | [**UpdateAnalysisDataTypesInputBody**](UpdateAnalysisDataTypesInputBody.md)| | | + +### Return type + +[**AnalysisDataTypesOutputBody**](AnalysisDataTypesOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **409** | Conflict | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + + +# **v3UpdateFunctionSignature** +> FunctionSignatureEntry v3UpdateFunctionSignature(analysisId, functionId, updateFunctionSignatureInputBody) + +Update a function's signature + +Replaces a function's parameters, return type and calling convention in full — anything left out of the request is cleared. Parameter and return types are `data_type_id`s belonging to this analysis. Edits an extracted signature only: a function with `has_signature` false is rejected with 404. The stored signature gets a `source_type` of `USER`, and its previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example +```java +// Import classes: +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.auth.*; +import ai.reveng.invoker.models.*; +import ai.reveng.api.DataTypesApi; + +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"); + + DataTypesApi apiInstance = new DataTypesApi(defaultClient); + Long analysisId = 56L; // Long | Analysis ID + Long functionId = 56L; // Long | Function ID + UpdateFunctionSignatureInputBody updateFunctionSignatureInputBody = new UpdateFunctionSignatureInputBody(); // UpdateFunctionSignatureInputBody | + try { + FunctionSignatureEntry result = apiInstance.v3UpdateFunctionSignature(analysisId, functionId, updateFunctionSignatureInputBody); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DataTypesApi#v3UpdateFunctionSignature"); + 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 | | +| **functionId** | **Long**| Function ID | | +| **updateFunctionSignatureInputBody** | [**UpdateFunctionSignatureInputBody**](UpdateFunctionSignatureInputBody.md)| | | + +### Return type + +[**FunctionSignatureEntry**](FunctionSignatureEntry.md) + +### Authorization + +[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | + diff --git a/docs/DataTypesEntry.md b/docs/DataTypesEntry.md deleted file mode 100644 index 490a6e7d..00000000 --- a/docs/DataTypesEntry.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# DataTypesEntry - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**dataTypes** | [**FunctionInfo**](FunctionInfo.md) | | [optional] | -|**dataTypesVersion** | **Long** | Current version of the function data types. Pass this back on the next write to satisfy the CAS check. | | -|**functionId** | **Long** | | | - - - diff --git a/docs/DisassemblyOutputBody.md b/docs/DisassemblyOutputBody.md index 1c5ed128..cc4fe3fc 100644 --- a/docs/DisassemblyOutputBody.md +++ b/docs/DisassemblyOutputBody.md @@ -9,6 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**basicBlocks** | **Object** | | [optional] | |**functionId** | **Long** | | | +|**globalVariables** | **Object** | | [optional] | |**localVariables** | **Object** | | [optional] | |**params** | **Object** | | [optional] | |**returnType** | **String** | Search is applied to string value | [optional] | diff --git a/docs/DynamicExecutionStatusResponse.md b/docs/DynamicExecutionStatusResponse.md index 10aa0f37..6a7cdb1c 100644 --- a/docs/DynamicExecutionStatusResponse.md +++ b/docs/DynamicExecutionStatusResponse.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**errorMessage** | **String** | Error detail, set when status is FAILED | [optional] | -|**logs** | [**AnalysisLogs**](AnalysisLogs.md) | Sandbox status log messages captured during the run. Contains a single \"No logs available\" message when none have been captured yet. | | +|**logs** | [**AnalysisLogs**](AnalysisLogs.md) | Sandbox status log messages captured during the run. Empty when none have been captured yet. | | |**status** | [**StatusEnum**](#StatusEnum) | Task status | | diff --git a/docs/EnumDataType.md b/docs/EnumDataType.md new file mode 100644 index 00000000..3f35b4e6 --- /dev/null +++ b/docs/EnumDataType.md @@ -0,0 +1,43 @@ + + +# EnumDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**EnumDefinition**](EnumDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| ENUM | "ENUM" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/EnumDefinition.md b/docs/EnumDefinition.md new file mode 100644 index 00000000..0c15972a --- /dev/null +++ b/docs/EnumDefinition.md @@ -0,0 +1,13 @@ + + +# EnumDefinition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**values** | [**List<DataTypeEnumValueEntry>**](DataTypeEnumValueEntry.md) | The type's constants. | | + + + diff --git a/docs/Enumeration.md b/docs/Enumeration.md deleted file mode 100644 index c79166fe..00000000 --- a/docs/Enumeration.md +++ /dev/null @@ -1,16 +0,0 @@ - - -# Enumeration - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this enumeration | [optional] | -|**name** | **String** | Name of the enumeration | | -|**members** | **Map<String, Integer>** | Dictionary of enumeration members and their values | | -|**artifactType** | **String** | Type of artifact that the enumeration is associated with | [optional] | - - - diff --git a/docs/FuncDepsInner.md b/docs/FuncDepsInner.md deleted file mode 100644 index ef74ffd3..00000000 --- a/docs/FuncDepsInner.md +++ /dev/null @@ -1,19 +0,0 @@ - - -# FuncDepsInner - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this global variable | [optional] | -|**name** | **String** | Name of the global variable | | -|**size** | **Integer** | Size of the global variable in bytes | | -|**members** | **Map<String, Integer>** | Dictionary of enumeration members and their values | | -|**artifactType** | **String** | Type of artifact that the global variable is associated with | [optional] | -|**type** | **String** | Data type of the global variable | | -|**addr** | **Integer** | Memory address of the global variable | | - - - diff --git a/docs/FunctionArgument.md b/docs/FunctionArgument.md deleted file mode 100644 index 831e73c8..00000000 --- a/docs/FunctionArgument.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# FunctionArgument - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | | [optional] | -|**name** | **String** | | | -|**offset** | **Long** | | | -|**scope** | **String** | | [optional] | -|**size** | **Long** | | | -|**type** | **String** | | | - - - diff --git a/docs/FunctionDataType.md b/docs/FunctionDataType.md new file mode 100644 index 00000000..c0fc081a --- /dev/null +++ b/docs/FunctionDataType.md @@ -0,0 +1,43 @@ + + +# FunctionDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**FunctionTypeDefinition**](FunctionTypeDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| FUNCTION_DEFINITION | "FUNCTION_DEFINITION" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/FunctionDataTypes.md b/docs/FunctionDataTypes.md deleted file mode 100644 index 7ecf2b3f..00000000 --- a/docs/FunctionDataTypes.md +++ /dev/null @@ -1,16 +0,0 @@ - - -# FunctionDataTypes - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**completed** | **Boolean** | Whether the service has completed data types generation | | -|**status** | **String** | The current status of the data types service | | -|**dataTypes** | [**V2FunctionInfo**](V2FunctionInfo.md) | Function data types information if available | [optional] | -|**dataTypesVersion** | **Integer** | If the data types information has been updated by the user, this field will be populated | [optional] | - - - diff --git a/docs/FunctionDataTypesList.md b/docs/FunctionDataTypesList.md deleted file mode 100644 index ee1d2d89..00000000 --- a/docs/FunctionDataTypesList.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# FunctionDataTypesList - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**totalCount** | **Integer** | Total number of functions in analysis | [optional] | -|**totalDataTypesCount** | **Integer** | Total number of functions with data types | [optional] | -|**items** | [**List<FunctionDataTypesListItem>**](FunctionDataTypesListItem.md) | List of function data types information | | - - - diff --git a/docs/FunctionDataTypesListItem.md b/docs/FunctionDataTypesListItem.md deleted file mode 100644 index 3fd02d2b..00000000 --- a/docs/FunctionDataTypesListItem.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# FunctionDataTypesListItem - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**completed** | **Boolean** | Whether the service has completed data types generation | | -|**status** | **String** | The current status of the data types service | | -|**dataTypes** | [**V2FunctionInfo**](V2FunctionInfo.md) | Function data types information if available | [optional] | -|**dataTypesVersion** | **Integer** | If the data types information has been updated by the user, this field will be populated | [optional] | -|**functionId** | **Long** | Function id | | - - - diff --git a/docs/FunctionDataTypesParams.md b/docs/FunctionDataTypesParams.md deleted file mode 100644 index 7a362d1c..00000000 --- a/docs/FunctionDataTypesParams.md +++ /dev/null @@ -1,13 +0,0 @@ - - -# FunctionDataTypesParams - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**functionIds** | **List<Long>** | The function ID's to generate/get data types for | | - - - diff --git a/docs/FunctionDataTypesStatus.md b/docs/FunctionDataTypesStatus.md deleted file mode 100644 index e753780b..00000000 --- a/docs/FunctionDataTypesStatus.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# FunctionDataTypesStatus - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**functionId** | **Long** | Function id | | -|**completed** | **Boolean** | Whether the service has completed data types generation | | -|**status** | **String** | The current status of the data types service | | - - - diff --git a/docs/FunctionDependency.md b/docs/FunctionDependency.md deleted file mode 100644 index fd5771a0..00000000 --- a/docs/FunctionDependency.md +++ /dev/null @@ -1,20 +0,0 @@ - - -# FunctionDependency - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**addr** | **Long** | Memory address (GlobalVariable). | [optional] | -|**artifactType** | **String** | | [optional] | -|**lastChange** | **String** | | [optional] | -|**members** | **Object** | | [optional] | -|**name** | **String** | | | -|**scope** | **String** | | [optional] | -|**size** | **Long** | Total byte size (Struct, GlobalVariable). | [optional] | -|**type** | **String** | Underlying type (TypeDefinition, GlobalVariable). | [optional] | - - - diff --git a/docs/FunctionHeader.md b/docs/FunctionHeader.md deleted file mode 100644 index c9d12a13..00000000 --- a/docs/FunctionHeader.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# FunctionHeader - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**addr** | **Long** | | | -|**args** | [**Map<String, FunctionArgument>**](FunctionArgument.md) | Argument map keyed by ordinal hex (e.g. \"0x0\", \"0x1\"). | | -|**lastChange** | **String** | | [optional] | -|**name** | **String** | | | -|**scope** | **String** | | [optional] | -|**type** | **String** | | | - - - diff --git a/docs/FunctionInfo.md b/docs/FunctionInfo.md deleted file mode 100644 index c50bc8a6..00000000 --- a/docs/FunctionInfo.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# FunctionInfo - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**funcDeps** | [**List<FunctionDependency>**](FunctionDependency.md) | | | -|**funcTypes** | [**FunctionType**](FunctionType.md) | | [optional] | - - - diff --git a/docs/FunctionRename.md b/docs/FunctionRename.md index f23802a9..02c56597 100644 --- a/docs/FunctionRename.md +++ b/docs/FunctionRename.md @@ -9,6 +9,7 @@ |------------ | ------------- | ------------- | -------------| |**newName** | **String** | The new name for the function | | |**newMangledName** | **String** | The new mangled name for the function | | +|**sourceType** | **FunctionSourceType** | The source that triggered the rename | [optional] | diff --git a/docs/FunctionSignatureBody.md b/docs/FunctionSignatureBody.md new file mode 100644 index 00000000..5a5b072f --- /dev/null +++ b/docs/FunctionSignatureBody.md @@ -0,0 +1,33 @@ + + +# FunctionSignatureBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callingConvention** | **String** | Calling convention, when the producer reported one. | [optional] | +|**createdAt** | **OffsetDateTime** | When this signature was extracted. | [optional] | +|**dataTypes** | [**List<DataTypeEntry>**](DataTypeEntry.md) | The types the signature names — its parameter types and its return type — ordered by data_type_id. Each entry is identical to the one the data types endpoints serve for that id. Returned only when include_data_types is true. | [optional] | +|**functionId** | **Long** | | | +|**functionName** | **String** | Current name of the function. | | +|**hasSignature** | **Boolean** | Whether a signature was extracted for this function. False is a normal result: no signature is recorded unless data type extraction ran for the analysis, and thunks and external functions are skipped when it does. | | +|**parameters** | [**List<SignatureParameterEntry>**](SignatureParameterEntry.md) | Parameters in argument order. Empty with has_signature true means the function is known to take no arguments. | | +|**returnDataTypeId** | **Long** | Return type, resolvable against the analysis data types list. Absent for an unresolved return type. | [optional] | +|**sourceFunctionId** | **Long** | The function this signature was copied from, when it was transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this signature came from. | [optional] | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/FunctionSignatureEntry.md b/docs/FunctionSignatureEntry.md new file mode 100644 index 00000000..81b6dd09 --- /dev/null +++ b/docs/FunctionSignatureEntry.md @@ -0,0 +1,32 @@ + + +# FunctionSignatureEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callingConvention** | **String** | Calling convention, when the producer reported one. | [optional] | +|**createdAt** | **OffsetDateTime** | When this signature was extracted. | [optional] | +|**functionId** | **Long** | | | +|**functionName** | **String** | Current name of the function. | | +|**hasSignature** | **Boolean** | Whether a signature was extracted for this function. False is a normal result: no signature is recorded unless data type extraction ran for the analysis, and thunks and external functions are skipped when it does. | | +|**parameters** | [**List<SignatureParameterEntry>**](SignatureParameterEntry.md) | Parameters in argument order. Empty with has_signature true means the function is known to take no arguments. | | +|**returnDataTypeId** | **Long** | Return type, resolvable against the analysis data types list. Absent for an unresolved return type. | [optional] | +|**sourceFunctionId** | **Long** | The function this signature was copied from, when it was transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this signature came from. | [optional] | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/FunctionSignatureVersion.md b/docs/FunctionSignatureVersion.md new file mode 100644 index 00000000..c25eab90 --- /dev/null +++ b/docs/FunctionSignatureVersion.md @@ -0,0 +1,15 @@ + + +# FunctionSignatureVersion + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**updatedAt** | **OffsetDateTime** | When this version was written. Absent on a version that predates the recorded history. | [optional] | +|**updatedBy** | [**HistoryActor**](HistoryActor.md) | Who wrote this version. Absent on a version that predates the recorded history. | [optional] | +|**value** | [**FunctionSignatureEntry**](FunctionSignatureEntry.md) | The signature as it stood in this version. | | + + + diff --git a/docs/FunctionStackVariable.md b/docs/FunctionStackVariable.md deleted file mode 100644 index 69961df3..00000000 --- a/docs/FunctionStackVariable.md +++ /dev/null @@ -1,19 +0,0 @@ - - -# FunctionStackVariable - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**addr** | **Long** | | | -|**lastChange** | **String** | | [optional] | -|**name** | **String** | | | -|**offset** | **Long** | | | -|**scope** | **String** | | [optional] | -|**size** | **Long** | | | -|**type** | **String** | | | - - - diff --git a/docs/FunctionType.md b/docs/FunctionType.md deleted file mode 100644 index 57c99c61..00000000 --- a/docs/FunctionType.md +++ /dev/null @@ -1,21 +0,0 @@ - - -# FunctionType - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**addr** | **Long** | | | -|**artifactType** | **String** | | [optional] | -|**header** | [**FunctionHeader**](FunctionHeader.md) | | | -|**lastChange** | **String** | | [optional] | -|**name** | **String** | | | -|**scope** | **String** | | [optional] | -|**size** | **Long** | | | -|**stackVars** | [**Map<String, FunctionStackVariable>**](FunctionStackVariable.md) | Stack variables keyed by offset hex. | [optional] | -|**type** | **String** | | | - - - diff --git a/docs/FunctionTypeDefinition.md b/docs/FunctionTypeDefinition.md new file mode 100644 index 00000000..6f236139 --- /dev/null +++ b/docs/FunctionTypeDefinition.md @@ -0,0 +1,14 @@ + + +# FunctionTypeDefinition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**parameters** | [**List<DataTypeFunctionParameterEntry>**](DataTypeFunctionParameterEntry.md) | The parameters, in argument order. | | +|**returnDataTypeId** | **Long** | The return type. | [optional] | + + + diff --git a/docs/FunctionsAiDecompilationApi.md b/docs/FunctionsAiDecompilationApi.md index dbeccffc..5771f8d9 100644 --- a/docs/FunctionsAiDecompilationApi.md +++ b/docs/FunctionsAiDecompilationApi.md @@ -13,18 +13,19 @@ All URIs are relative to *https://api.reveng.ai* | [**getAiDecompilationStatus**](FunctionsAiDecompilationApi.md#getAiDecompilationStatus) | **GET** /v3/functions/{function_id}/ai-decompilation/status | Get AI decompilation workflow status | | [**getAiDecompilationSummary**](FunctionsAiDecompilationApi.md#getAiDecompilationSummary) | **GET** /v3/functions/{function_id}/ai-decompilation/summary | Get AI decompilation summary | | [**getAiDecompilationSummaryStatus**](FunctionsAiDecompilationApi.md#getAiDecompilationSummaryStatus) | **GET** /v3/functions/{function_id}/ai-decompilation/summary/status | Get summary generation workflow status | -| [**getAiDecompilationTokenised**](FunctionsAiDecompilationApi.md#getAiDecompilationTokenised) | **GET** /v3/functions/{function_id}/ai-decompilation/tokenised | Get tokenised AI decompilation with function mapping | | [**patchAiDecompilationInlineComment**](FunctionsAiDecompilationApi.md#patchAiDecompilationInlineComment) | **PATCH** /v3/functions/{function_id}/ai-decompilation/inline-comments | Update a single inline comment | | [**regenerateAiDecompilationInlineComments**](FunctionsAiDecompilationApi.md#regenerateAiDecompilationInlineComments) | **POST** /v3/functions/{function_id}/ai-decompilation/inline-comments | Regenerate AI decompilation inline comments | | [**regenerateAiDecompilationSummary**](FunctionsAiDecompilationApi.md#regenerateAiDecompilationSummary) | **POST** /v3/functions/{function_id}/ai-decompilation/summary | Regenerate AI decompilation summary | | [**streamAiDecompilation**](FunctionsAiDecompilationApi.md#streamAiDecompilation) | **GET** /v3/functions/{function_id}/ai-decompilation/events | Stream live AI decompilation output (SSE) | -| [**upsertAiDecompilationOverrides**](FunctionsAiDecompilationApi.md#upsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides | | [**upsertAiDecompilationRating**](FunctionsAiDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation | +| [**v3GetAiDecompilationLineAttributions**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationLineAttributions) | **GET** /v3/functions/{function_id}/ai-decompilation/line-attributions | Get AI decompilation line attributions | +| [**v3GetAiDecompilationTokens**](FunctionsAiDecompilationApi.md#v3GetAiDecompilationTokens) | **GET** /v3/functions/{function_id}/ai-decompilation/tokens | Get AI decompilation tokens and user overrides | +| [**v3UpsertAiDecompilationOverrides**](FunctionsAiDecompilationApi.md#v3UpsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides | # **createAiDecompilation** -> CreateAIDecompOutputBody createAiDecompilation(functionId, contextAware, temperature) +> CreateAIDecompOutputBody createAiDecompilation(functionId, temperature) Start AI decompilation @@ -57,10 +58,9 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | Function ID - Boolean contextAware = false; // Boolean | Use context-aware decompilation Double temperature = -1D; // Double | LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. try { - CreateAIDecompOutputBody result = apiInstance.createAiDecompilation(functionId, contextAware, temperature); + CreateAIDecompOutputBody result = apiInstance.createAiDecompilation(functionId, temperature); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FunctionsAiDecompilationApi#createAiDecompilation"); @@ -78,7 +78,6 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **functionId** | **Long**| Function ID | | -| **contextAware** | **Boolean**| Use context-aware decompilation | [optional] [default to false] | | **temperature** | **Double**| LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. | [optional] [default to -1] | ### Return type @@ -718,13 +717,13 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | - -# **getAiDecompilationTokenised** -> TokenisedData getAiDecompilationTokenised(functionId) + +# **patchAiDecompilationInlineComment** +> CommentsData patchAiDecompilationInlineComment(functionId, patchCommentBody) -Get tokenised AI decompilation with function mapping +Update a single inline comment -Returns the decompilation with placeholder tokens, the function mapping for token resolution, and the predicted function name. **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 +Merges a single line comment into the existing AI-generated inline comments. Requires comments to have been generated first. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found ### Example ```java @@ -753,11 +752,12 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | Function ID + PatchCommentBody patchCommentBody = new PatchCommentBody(); // PatchCommentBody | try { - TokenisedData result = apiInstance.getAiDecompilationTokenised(functionId); + CommentsData result = apiInstance.patchAiDecompilationInlineComment(functionId, patchCommentBody); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FunctionsAiDecompilationApi#getAiDecompilationTokenised"); + System.err.println("Exception when calling FunctionsAiDecompilationApi#patchAiDecompilationInlineComment"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -772,10 +772,11 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **functionId** | **Long**| Function ID | | +| **patchCommentBody** | [**PatchCommentBody**](PatchCommentBody.md)| | | ### Return type -[**TokenisedData**](TokenisedData.md) +[**CommentsData**](CommentsData.md) ### Authorization @@ -783,7 +784,7 @@ public class Example { ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details @@ -795,13 +796,13 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | - -# **patchAiDecompilationInlineComment** -> CommentsData patchAiDecompilationInlineComment(functionId, patchCommentBody) + +# **regenerateAiDecompilationInlineComments** +> RegenerateOutputBody regenerateAiDecompilationInlineComments(functionId) -Update a single inline comment +Regenerate AI decompilation inline comments -Merges a single line comment into the existing AI-generated inline comments. Requires comments to have been generated first. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +Starts a new inline comments generation workflow for the function. Requires an existing decompilation with a summary. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found ### Example ```java @@ -830,12 +831,11 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | Function ID - PatchCommentBody patchCommentBody = new PatchCommentBody(); // PatchCommentBody | try { - CommentsData result = apiInstance.patchAiDecompilationInlineComment(functionId, patchCommentBody); + RegenerateOutputBody result = apiInstance.regenerateAiDecompilationInlineComments(functionId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FunctionsAiDecompilationApi#patchAiDecompilationInlineComment"); + System.err.println("Exception when calling FunctionsAiDecompilationApi#regenerateAiDecompilationInlineComments"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -850,11 +850,10 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **functionId** | **Long**| Function ID | | -| **patchCommentBody** | [**PatchCommentBody**](PatchCommentBody.md)| | | ### Return type -[**CommentsData**](CommentsData.md) +[**RegenerateOutputBody**](RegenerateOutputBody.md) ### Authorization @@ -862,25 +861,25 @@ public class Example { ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | OK | - | +| **202** | Accepted | - | | **403** | Forbidden | - | | **404** | Not Found | - | | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | - -# **regenerateAiDecompilationInlineComments** -> RegenerateOutputBody regenerateAiDecompilationInlineComments(functionId) + +# **regenerateAiDecompilationSummary** +> RegenerateOutputBody regenerateAiDecompilationSummary(functionId) -Regenerate AI decompilation inline comments +Regenerate AI decompilation summary -Starts a new inline comments generation workflow for the function. Requires an existing decompilation with a summary. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +Starts a new summary generation workflow for the function. Requires an existing decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found ### Example ```java @@ -910,10 +909,10 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | Function ID try { - RegenerateOutputBody result = apiInstance.regenerateAiDecompilationInlineComments(functionId); + RegenerateOutputBody result = apiInstance.regenerateAiDecompilationSummary(functionId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FunctionsAiDecompilationApi#regenerateAiDecompilationInlineComments"); + System.err.println("Exception when calling FunctionsAiDecompilationApi#regenerateAiDecompilationSummary"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -951,13 +950,13 @@ public class Example { | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | - -# **regenerateAiDecompilationSummary** -> RegenerateOutputBody regenerateAiDecompilationSummary(functionId) + +# **streamAiDecompilation** +> List<ServerSentEventsInner1> streamAiDecompilation(functionId) -Regenerate AI decompilation summary +Stream live AI decompilation output (SSE) -Starts a new summary generation workflow for the function. Requires an existing decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal — Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported — clients fall back to polling the standard GET endpoint after the stream ends. ### Example ```java @@ -987,10 +986,10 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | Function ID try { - RegenerateOutputBody result = apiInstance.regenerateAiDecompilationSummary(functionId); + List result = apiInstance.streamAiDecompilation(functionId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FunctionsAiDecompilationApi#regenerateAiDecompilationSummary"); + System.err.println("Exception when calling FunctionsAiDecompilationApi#streamAiDecompilation"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -1008,7 +1007,7 @@ public class Example { ### Return type -[**RegenerateOutputBody**](RegenerateOutputBody.md) +[**List<ServerSentEventsInner1>**](ServerSentEventsInner1.md) ### Authorization @@ -1017,24 +1016,95 @@ public class Example { ### HTTP request headers - **Content-Type**: Not defined + - **Accept**: text/event-stream, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **0** | Error | - | + + +# **upsertAiDecompilationRating** +> BaseResponse upsertAiDecompilationRating(functionId, upsertAiDecomplationRatingRequest) + +Upsert rating for AI decompilation + +### 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 | The ID of the function being rated + UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest = new UpsertAiDecomplationRatingRequest(); // UpsertAiDecomplationRatingRequest | + try { + BaseResponse result = apiInstance.upsertAiDecompilationRating(functionId, upsertAiDecomplationRatingRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FunctionsAiDecompilationApi#upsertAiDecompilationRating"); + 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**| The ID of the function being rated | | +| **upsertAiDecomplationRatingRequest** | [**UpsertAiDecomplationRatingRequest**](UpsertAiDecomplationRatingRequest.md)| | | + +### Return type + +[**BaseResponse**](BaseResponse.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 | |-------------|-------------|------------------| -| **202** | Accepted | - | -| **403** | Forbidden | - | -| **404** | Not Found | - | -| **422** | Unprocessable Entity | - | -| **500** | Internal Server Error | - | +| **201** | Successful Response | - | +| **422** | Invalid request parameters | - | - -# **streamAiDecompilation** -> List<ServerSentEventsInner1> streamAiDecompilation(functionId) + +# **v3GetAiDecompilationLineAttributions** +> LineAttributionsData v3GetAiDecompilationLineAttributions(functionId) -Stream live AI decompilation output (SSE) +Get AI decompilation line attributions -Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal — Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported — clients fall back to polling the standard GET endpoint after the stream ends. +Returns the correspondence between the function's disassembly line numbers and its AI-decompilation line numbers, grouped by disassembly line. Both sides are 0-indexed and the correspondence has a many-to-many relationship. The mapping is empty until a completed run has produced one, and is empty for a run that produced none. **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 @@ -1064,10 +1134,10 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | Function ID try { - List result = apiInstance.streamAiDecompilation(functionId); + LineAttributionsData result = apiInstance.v3GetAiDecompilationLineAttributions(functionId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FunctionsAiDecompilationApi#streamAiDecompilation"); + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3GetAiDecompilationLineAttributions"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -1085,7 +1155,7 @@ public class Example { ### Return type -[**List<ServerSentEventsInner1>**](ServerSentEventsInner1.md) +[**LineAttributionsData**](LineAttributionsData.md) ### Authorization @@ -1094,21 +1164,24 @@ public class Example { ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: text/event-stream, application/json + - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | OK | - | -| **0** | Error | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | - -# **upsertAiDecompilationOverrides** -> UpsertOverridesData upsertAiDecompilationOverrides(functionId, upsertOverridesInputBody) + +# **v3GetAiDecompilationTokens** +> GetTokensResponse v3GetAiDecompilationTokens(functionId) -Upsert variable/function name overrides +Get AI decompilation tokens and user overrides -Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request +Returns the tokenised AI-decompilation source, the value each token resolves to, and the user's overrides as a separate unmerged map. The source is empty and the overrides are null until a run has succeeded. **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 @@ -1137,12 +1210,11 @@ public class Example { FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); Long functionId = 56L; // Long | Function ID - UpsertOverridesInputBody upsertOverridesInputBody = new UpsertOverridesInputBody(); // UpsertOverridesInputBody | try { - UpsertOverridesData result = apiInstance.upsertAiDecompilationOverrides(functionId, upsertOverridesInputBody); + GetTokensResponse result = apiInstance.v3GetAiDecompilationTokens(functionId); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FunctionsAiDecompilationApi#upsertAiDecompilationOverrides"); + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3GetAiDecompilationTokens"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -1157,11 +1229,10 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| | **functionId** | **Long**| Function ID | | -| **upsertOverridesInputBody** | [**UpsertOverridesInputBody**](UpsertOverridesInputBody.md)| | | ### Return type -[**UpsertOverridesData**](UpsertOverridesData.md) +[**GetTokensResponse**](GetTokensResponse.md) ### Authorization @@ -1169,24 +1240,25 @@ public class Example { ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| | **200** | OK | - | -| **400** | Bad Request | - | | **403** | Forbidden | - | | **404** | Not Found | - | | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | - -# **upsertAiDecompilationRating** -> BaseResponse upsertAiDecompilationRating(functionId, upsertAiDecomplationRatingRequest) + +# **v3UpsertAiDecompilationOverrides** +> UpsertOverridesData v3UpsertAiDecompilationOverrides(functionId, upsertOverridesInputBody) -Upsert rating for AI decompilation +Upsert variable/function name overrides + +Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error ### Example ```java @@ -1214,13 +1286,13 @@ public class Example { bearerAuth.setBearerToken("BEARER TOKEN"); FunctionsAiDecompilationApi apiInstance = new FunctionsAiDecompilationApi(defaultClient); - Long functionId = 56L; // Long | The ID of the function being rated - UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest = new UpsertAiDecomplationRatingRequest(); // UpsertAiDecomplationRatingRequest | + Long functionId = 56L; // Long | Function ID + UpsertOverridesInputBody upsertOverridesInputBody = new UpsertOverridesInputBody(); // UpsertOverridesInputBody | try { - BaseResponse result = apiInstance.upsertAiDecompilationRating(functionId, upsertAiDecomplationRatingRequest); + UpsertOverridesData result = apiInstance.v3UpsertAiDecompilationOverrides(functionId, upsertOverridesInputBody); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FunctionsAiDecompilationApi#upsertAiDecompilationRating"); + System.err.println("Exception when calling FunctionsAiDecompilationApi#v3UpsertAiDecompilationOverrides"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -1234,12 +1306,12 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **functionId** | **Long**| The ID of the function being rated | | -| **upsertAiDecomplationRatingRequest** | [**UpsertAiDecomplationRatingRequest**](UpsertAiDecomplationRatingRequest.md)| | | +| **functionId** | **Long**| Function ID | | +| **upsertOverridesInputBody** | [**UpsertOverridesInputBody**](UpsertOverridesInputBody.md)| | | ### Return type -[**BaseResponse**](BaseResponse.md) +[**UpsertOverridesData**](UpsertOverridesData.md) ### Authorization @@ -1253,6 +1325,10 @@ public class Example { ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **201** | Successful Response | - | -| **422** | Invalid request parameters | - | +| **200** | OK | - | +| **400** | Bad Request | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **422** | Unprocessable Entity | - | +| **500** | Internal Server Error | - | diff --git a/docs/FunctionsCoreApi.md b/docs/FunctionsCoreApi.md index c767d026..af6f8af3 100644 --- a/docs/FunctionsCoreApi.md +++ b/docs/FunctionsCoreApi.md @@ -430,7 +430,7 @@ public class Example { Get function disassembly -Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. A function that carries no disassembly (externals, thunks) returns 200 with the block fields omitted; disassembly that exists but cannot be read yet returns 409 ANALYSIS_NOT_READY. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready ### Example ```java @@ -498,6 +498,7 @@ public class Example { | **200** | OK | - | | **403** | Forbidden | - | | **404** | Not Found | - | +| **409** | Conflict | - | | **422** | Unprocessable Entity | - | | **500** | Internal Server Error | - | diff --git a/docs/FunctionsDataTypesApi.md b/docs/FunctionsDataTypesApi.md deleted file mode 100644 index 91fb4ccf..00000000 --- a/docs/FunctionsDataTypesApi.md +++ /dev/null @@ -1,718 +0,0 @@ -# FunctionsDataTypesApi - -All URIs are relative to *https://api.reveng.ai* - -| Method | HTTP request | Description | -|------------- | ------------- | -------------| -| [**batchUpdateFunctionDataTypes**](FunctionsDataTypesApi.md#batchUpdateFunctionDataTypes) | **PUT** /v3/analyses/{analysis_id}/functions/data-types | Batch update function data types | -| [**generateFunctionDataTypesForAnalysis**](FunctionsDataTypesApi.md#generateFunctionDataTypesForAnalysis) | **POST** /v2/analyses/{analysis_id}/functions/data_types | Generate Function Data Types | -| [**generateFunctionDataTypesForFunctions**](FunctionsDataTypesApi.md#generateFunctionDataTypesForFunctions) | **POST** /v2/functions/data_types | Generate Function Data Types for an arbitrary list of functions | -| [**getFunctionDataTypes**](FunctionsDataTypesApi.md#getFunctionDataTypes) | **GET** /v3/analyses/{analysis_id}/functions/{function_id}/data-types | Get data types for a single function | -| [**listAnalysisFunctionsDataTypes**](FunctionsDataTypesApi.md#listAnalysisFunctionsDataTypes) | **GET** /v3/analyses/{analysis_id}/functions/data-types | List data types for all functions in an analysis | -| [**listFunctionDataTypesForAnalysis**](FunctionsDataTypesApi.md#listFunctionDataTypesForAnalysis) | **GET** /v2/analyses/{analysis_id}/functions/data_types | List Function Data Types | -| [**listFunctionDataTypesForFunctions**](FunctionsDataTypesApi.md#listFunctionDataTypesForFunctions) | **GET** /v2/functions/data_types | List Function Data Types | -| [**listFunctionsDataTypes**](FunctionsDataTypesApi.md#listFunctionsDataTypes) | **GET** /v3/functions/data-types | Get data types for many functions | -| [**updateFunctionDataTypes**](FunctionsDataTypesApi.md#updateFunctionDataTypes) | **PUT** /v2/analyses/{analysis_id}/functions/{function_id}/data_types | Update function data types | - - - -# **batchUpdateFunctionDataTypes** -> BatchUpdateDataTypesOutputBody batchUpdateFunctionDataTypes(analysisId, batchUpdateDataTypesInputBody) - -Batch update function data types - -Updates data types for multiple functions in one analysis. All function IDs in the body must belong to the analysis. Each item is processed independently and reports its own outcome: a stale `data_types_version` yields `version_conflict` for that item without affecting the rest of the batch. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - -### 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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - Long analysisId = 56L; // Long | Analysis ID - BatchUpdateDataTypesInputBody batchUpdateDataTypesInputBody = new BatchUpdateDataTypesInputBody(); // BatchUpdateDataTypesInputBody | - try { - BatchUpdateDataTypesOutputBody result = apiInstance.batchUpdateFunctionDataTypes(analysisId, batchUpdateDataTypesInputBody); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#batchUpdateFunctionDataTypes"); - 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 | | -| **batchUpdateDataTypesInputBody** | [**BatchUpdateDataTypesInputBody**](BatchUpdateDataTypesInputBody.md)| | | - -### Return type - -[**BatchUpdateDataTypesOutputBody**](BatchUpdateDataTypesOutputBody.md) - -### Authorization - -[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | OK | - | -| **400** | Bad Request | - | -| **403** | Forbidden | - | -| **404** | Not Found | - | -| **422** | Unprocessable Entity | - | -| **500** | Internal Server Error | - | - - -# **generateFunctionDataTypesForAnalysis** -> BaseResponseGenerateFunctionDataTypes generateFunctionDataTypesForAnalysis(analysisId, functionDataTypesParams) - -Generate Function Data Types - -Submits a request to generate the function data types - -### 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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - Integer analysisId = 56; // Integer | - FunctionDataTypesParams functionDataTypesParams = new FunctionDataTypesParams(); // FunctionDataTypesParams | - try { - BaseResponseGenerateFunctionDataTypes result = apiInstance.generateFunctionDataTypesForAnalysis(analysisId, functionDataTypesParams); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#generateFunctionDataTypesForAnalysis"); - 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** | **Integer**| | | -| **functionDataTypesParams** | [**FunctionDataTypesParams**](FunctionDataTypesParams.md)| | | - -### Return type - -[**BaseResponseGenerateFunctionDataTypes**](BaseResponseGenerateFunctionDataTypes.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** | Successful Response | - | -| **422** | Invalid request parameters | - | - - -# **generateFunctionDataTypesForFunctions** -> BaseResponseGenerationStatusList generateFunctionDataTypesForFunctions(functionDataTypesParams) - -Generate Function Data Types for an arbitrary list of functions - -Submits a request to generate the function data types - -### 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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - FunctionDataTypesParams functionDataTypesParams = new FunctionDataTypesParams(); // FunctionDataTypesParams | - try { - BaseResponseGenerationStatusList result = apiInstance.generateFunctionDataTypesForFunctions(functionDataTypesParams); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#generateFunctionDataTypesForFunctions"); - 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 | -|------------- | ------------- | ------------- | -------------| -| **functionDataTypesParams** | [**FunctionDataTypesParams**](FunctionDataTypesParams.md)| | | - -### Return type - -[**BaseResponseGenerationStatusList**](BaseResponseGenerationStatusList.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** | Successful Response | - | -| **422** | Invalid request parameters | - | - - -# **getFunctionDataTypes** -> DataTypesEntry getFunctionDataTypes(analysisId, functionId) - -Get data types for a single function - -Returns the stored data-types blob for one function. The function must belong to the supplied analysis. **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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - Long analysisId = 56L; // Long | Analysis ID - Long functionId = 56L; // Long | Function ID - try { - DataTypesEntry result = apiInstance.getFunctionDataTypes(analysisId, functionId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#getFunctionDataTypes"); - 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 | | -| **functionId** | **Long**| Function ID | | - -### Return type - -[**DataTypesEntry**](DataTypesEntry.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 | - | - - -# **listAnalysisFunctionsDataTypes** -> ListAnalysisFunctionsDataTypesOutputBody listAnalysisFunctionsDataTypes(analysisId, offset, limit) - -List data types for all functions in an analysis - -Paginated read of the stored data-types blob for each function in the analysis. **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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - Long analysisId = 56L; // Long | Analysis ID - Long offset = 56L; // Long | Pagination offset. Defaults to 0. - Long limit = 56L; // Long | Page size. Defaults to 100. - try { - ListAnalysisFunctionsDataTypesOutputBody result = apiInstance.listAnalysisFunctionsDataTypes(analysisId, offset, limit); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#listAnalysisFunctionsDataTypes"); - 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 | | -| **offset** | **Long**| Pagination offset. Defaults to 0. | [optional] | -| **limit** | **Long**| Page size. Defaults to 100. | [optional] | - -### Return type - -[**ListAnalysisFunctionsDataTypesOutputBody**](ListAnalysisFunctionsDataTypesOutputBody.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 | - | - - -# **listFunctionDataTypesForAnalysis** -> BaseResponseFunctionDataTypesList listFunctionDataTypesForAnalysis(analysisId, functionIds) - -List Function Data Types - -Returns data types for multiple functions with optional function ID filtering - -### 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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - Integer analysisId = 56; // Integer | - List functionIds = Arrays.asList(); // List | - try { - BaseResponseFunctionDataTypesList result = apiInstance.listFunctionDataTypesForAnalysis(analysisId, functionIds); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#listFunctionDataTypesForAnalysis"); - 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** | **Integer**| | | -| **functionIds** | [**List<Integer>**](Integer.md)| | [optional] | - -### Return type - -[**BaseResponseFunctionDataTypesList**](BaseResponseFunctionDataTypesList.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** | Successful Response | - | -| **422** | Invalid request parameters | - | - - -# **listFunctionDataTypesForFunctions** -> BaseResponseFunctionDataTypesList listFunctionDataTypesForFunctions(functionIds) - -List Function Data Types - -Returns data types for multiple function IDs - -### 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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - List functionIds = Arrays.asList(); // List | - try { - BaseResponseFunctionDataTypesList result = apiInstance.listFunctionDataTypesForFunctions(functionIds); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#listFunctionDataTypesForFunctions"); - 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 | -|------------- | ------------- | ------------- | -------------| -| **functionIds** | [**List<Integer>**](Integer.md)| | [optional] | - -### Return type - -[**BaseResponseFunctionDataTypesList**](BaseResponseFunctionDataTypesList.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** | Successful Response | - | -| **422** | Invalid request parameters | - | - - -# **listFunctionsDataTypes** -> ListFunctionsDataTypesOutputBody listFunctionsDataTypes(functionIds) - -Get data types for many functions - -Returns the stored data-types blob for each supplied function ID. Caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - -### 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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - List functionIds = Arrays.asList(); // List | Function IDs to fetch data-types for. - try { - ListFunctionsDataTypesOutputBody result = apiInstance.listFunctionsDataTypes(functionIds); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#listFunctionsDataTypes"); - 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 | -|------------- | ------------- | ------------- | -------------| -| **functionIds** | [**List<Long>**](Long.md)| Function IDs to fetch data-types for. | | - -### Return type - -[**ListFunctionsDataTypesOutputBody**](ListFunctionsDataTypesOutputBody.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 | - | -| **400** | Bad Request | - | -| **403** | Forbidden | - | -| **404** | Not Found | - | -| **422** | Unprocessable Entity | - | -| **500** | Internal Server Error | - | - - -# **updateFunctionDataTypes** -> UpdateDataTypesOutputBody updateFunctionDataTypes(analysisId, functionId, updateDataTypesInputBody) - -Update function data types - -Stores user-specific overrides for a function's data types. Uses optimistic concurrency: if the stored version doesn't match `data_types_version`, the update is rejected with 409. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - -### 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.FunctionsDataTypesApi; - -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"); - - FunctionsDataTypesApi apiInstance = new FunctionsDataTypesApi(defaultClient); - Long analysisId = 56L; // Long | Analysis ID - Long functionId = 56L; // Long | Function ID - UpdateDataTypesInputBody updateDataTypesInputBody = new UpdateDataTypesInputBody(); // UpdateDataTypesInputBody | - try { - UpdateDataTypesOutputBody result = apiInstance.updateFunctionDataTypes(analysisId, functionId, updateDataTypesInputBody); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling FunctionsDataTypesApi#updateFunctionDataTypes"); - 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 | | -| **functionId** | **Long**| Function ID | | -| **updateDataTypesInputBody** | [**UpdateDataTypesInputBody**](UpdateDataTypesInputBody.md)| | | - -### Return type - -[**UpdateDataTypesOutputBody**](UpdateDataTypesOutputBody.md) - -### Authorization - -[APIKey](../README.md#APIKey), [bearerAuth](../README.md#bearerAuth) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | OK | - | -| **400** | Bad Request | - | -| **403** | Forbidden | - | -| **404** | Not Found | - | -| **409** | Conflict | - | -| **422** | Unprocessable Entity | - | -| **500** | Internal Server Error | - | - diff --git a/docs/FunctionsRenamingHistoryApi.md b/docs/FunctionsRenamingHistoryApi.md index 2cc5e7ab..a7b73519 100644 --- a/docs/FunctionsRenamingHistoryApi.md +++ b/docs/FunctionsRenamingHistoryApi.md @@ -94,7 +94,7 @@ public class Example { Batch rename functions -Renames multiple functions in a single request. Records name changes in history and copies data types from source functions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request +Renames multiple functions in a single request. Records name changes in history. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request ### Example ```java diff --git a/docs/GenerateFunctionDataTypes.md b/docs/GenerateFunctionDataTypes.md deleted file mode 100644 index 9329468c..00000000 --- a/docs/GenerateFunctionDataTypes.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# GenerateFunctionDataTypes - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**queued** | **Boolean** | [DEPRECATED] This value has been replaced with the `data_types_list` field | | -|**reference** | **String** | [DEPRECATED] This value has been replaced with the `data_types_list` field | | -|**dataTypesList** | [**GenerationStatusList**](GenerationStatusList.md) | List of function data types information that are either already generated, or now queued for generation | | - - - diff --git a/docs/GenerationStatusList.md b/docs/GenerationStatusList.md deleted file mode 100644 index 7f352562..00000000 --- a/docs/GenerationStatusList.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# GenerationStatusList - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**totalCount** | **Integer** | Total number of functions in analysis | [optional] | -|**totalDataTypesCount** | **Integer** | Total number of functions with data types | [optional] | -|**items** | [**List<FunctionDataTypesStatus>**](FunctionDataTypesStatus.md) | List of function data types information | | - - - diff --git a/docs/GetAnalysisLogsOutputBody.md b/docs/GetAnalysisLogsOutputBody.md new file mode 100644 index 00000000..a9d8d436 --- /dev/null +++ b/docs/GetAnalysisLogsOutputBody.md @@ -0,0 +1,13 @@ + + +# GetAnalysisLogsOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**entries** | [**List<AnalysisLogEntry>**](AnalysisLogEntry.md) | Analysis log lines, oldest first | | + + + diff --git a/docs/GetDataTypeHistoryBody.md b/docs/GetDataTypeHistoryBody.md new file mode 100644 index 00000000..8d8a4d0f --- /dev/null +++ b/docs/GetDataTypeHistoryBody.md @@ -0,0 +1,13 @@ + + +# GetDataTypeHistoryBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**versions** | [**List<DataTypeVersion>**](DataTypeVersion.md) | Every version of the type, newest first. The first element is the current value, so the list is never empty; a type that has never been edited has that one element only. | | + + + diff --git a/docs/GetFunctionSignatureHistoryBody.md b/docs/GetFunctionSignatureHistoryBody.md new file mode 100644 index 00000000..f497fce5 --- /dev/null +++ b/docs/GetFunctionSignatureHistoryBody.md @@ -0,0 +1,13 @@ + + +# GetFunctionSignatureHistoryBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**versions** | [**List<FunctionSignatureVersion>**](FunctionSignatureVersion.md) | Every version of the signature, newest first. The first element is the current value, so the list is never empty; a signature that has never been edited has that one element only. | | + + + diff --git a/docs/GetTokensResponse.md b/docs/GetTokensResponse.md new file mode 100644 index 00000000..13bdf7ec --- /dev/null +++ b/docs/GetTokensResponse.md @@ -0,0 +1,16 @@ + + +# GetTokensResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**aiDecomp** | **String** | Tokenised AI-decompilation. Includes generated comments. Empty until a run has succeeded. | | +|**analysisId** | **Long** | Analysis the function belongs to. Scopes every data_type_id below. | | +|**placeholderToRenderedToken** | [**Map<String, RenderedToken>**](RenderedToken.md) | Each placeholder token mapped to the value the server would render in its place, and the record it refers to. Null until a run has succeeded. | | +|**placeholderToUserOverride** | [**Map<String, Token>**](Token.md) | The caller's own overrides, keyed by token. Null until a run has succeeded. | | + + + diff --git a/docs/GlobalVariable.md b/docs/GlobalVariable.md deleted file mode 100644 index 8ff59460..00000000 --- a/docs/GlobalVariable.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# GlobalVariable - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this global variable | [optional] | -|**addr** | **Integer** | Memory address of the global variable | | -|**name** | **String** | Name of the global variable | | -|**type** | **String** | Data type of the global variable | | -|**size** | **Integer** | Size of the global variable in bytes | | -|**artifactType** | **String** | Type of artifact that the global variable is associated with | [optional] | - - - diff --git a/docs/HistoryActor.md b/docs/HistoryActor.md new file mode 100644 index 00000000..26f23c9c --- /dev/null +++ b/docs/HistoryActor.md @@ -0,0 +1,14 @@ + + +# HistoryActor + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**userId** | **Long** | The user who made the change. | | +|**username** | **String** | Absent when the user no longer exists. | [optional] | + + + diff --git a/docs/LineAttributionsData.md b/docs/LineAttributionsData.md new file mode 100644 index 00000000..0a9ffc2b --- /dev/null +++ b/docs/LineAttributionsData.md @@ -0,0 +1,13 @@ + + +# LineAttributionsData + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**disassemblyLineNumberToAiDecompilationLineNumbers** | **Map<String, List<Long>>** | Each disassembly line number mapped to the AI-decompilation line numbers it fed, e.g. {\"12\": [3, 4, 6], \"17\": [4]}. Both sides 0-based; many-to-many in both directions. Empty when no completed run has produced a correspondence, which is ordinary and not an error. | | + + + diff --git a/docs/ListAnalysisDataTypesOutputBody.md b/docs/ListAnalysisDataTypesOutputBody.md new file mode 100644 index 00000000..9cfd6ceb --- /dev/null +++ b/docs/ListAnalysisDataTypesOutputBody.md @@ -0,0 +1,14 @@ + + +# ListAnalysisDataTypesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**items** | [**List<DataTypeEntry>**](DataTypeEntry.md) | | | +|**totalCount** | **Long** | Total types matching the filters, ignoring pagination. | | + + + diff --git a/docs/ListAnalysisFunctionsDataTypesOutputBody.md b/docs/ListAnalysisFunctionsDataTypesOutputBody.md deleted file mode 100644 index e1765ac9..00000000 --- a/docs/ListAnalysisFunctionsDataTypesOutputBody.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# ListAnalysisFunctionsDataTypesOutputBody - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**items** | [**List<DataTypesEntry>**](DataTypesEntry.md) | | | -|**totalCount** | **Long** | Total functions in the analysis, ignoring pagination. | | - - - diff --git a/docs/ListDataTypeFunctionsBody.md b/docs/ListDataTypeFunctionsBody.md new file mode 100644 index 00000000..467e4891 --- /dev/null +++ b/docs/ListDataTypeFunctionsBody.md @@ -0,0 +1,14 @@ + + +# ListDataTypeFunctionsBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**items** | [**List<DataTypeFunctionEntry>**](DataTypeFunctionEntry.md) | The page of matching functions, in ascending function ID order. Empty when no function uses the type. | | +|**nextAfterFunctionId** | **Long** | Pass as after_function_id to fetch the next page. Absent on the last page. | [optional] | + + + diff --git a/docs/ListFunctionSignaturesOutputBody.md b/docs/ListFunctionSignaturesOutputBody.md new file mode 100644 index 00000000..f50a50e2 --- /dev/null +++ b/docs/ListFunctionSignaturesOutputBody.md @@ -0,0 +1,14 @@ + + +# ListFunctionSignaturesOutputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypes** | [**List<AnalysisDataTypesGroup>**](AnalysisDataTypesGroup.md) | The types the returned signatures name, grouped by analysis and ordered by analysis_id. Returned only when include_data_types is true. | [optional] | +|**items** | [**List<BatchFunctionSignatureEntry>**](BatchFunctionSignatureEntry.md) | One entry per distinct requested function ID, in request order. A repeated ID yields one entry. | | + + + diff --git a/docs/MatchFilters.md b/docs/MatchFilters.md index c0457b4c..5432affb 100644 --- a/docs/MatchFilters.md +++ b/docs/MatchFilters.md @@ -7,37 +7,36 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**arch** | [**ArchEnum**](#ArchEnum) | Restrict matches to this architecture (multi-platform models only; matches all architectures if omitted). Rejected for single-architecture models. | [optional] | +|**architectures** | [**List<ArchitecturesEnum>**](#List<ArchitecturesEnum>) | Restrict matches to candidates whose binary was detected as one of these architectures. Word size is part of the value, so there is no separate bits filter. Matches all architectures if omitted. | [optional] | |**binaryIds** | **List<Long>** | Restrict the candidate pool to these binary IDs. | [optional] | -|**bits** | **Long** | Restrict matches to this word size (multi-platform models only). Rejected for single-architecture models. | [optional] | |**collectionIds** | **List<Long>** | Restrict the candidate pool to binaries in these collection IDs. | [optional] | +|**debug** | **Boolean** | Restrict matches to candidates with auto/system debug symbols. Multi-platform models only; rejected for single-architecture models. | [optional] | |**debugTypes** | **List<String>** | Restrict matches to candidates with these debug source types. Accepted: SYSTEM, USER. | [optional] | |**functionIds** | **List<Long>** | Restrict the candidate pool to these function IDs. | [optional] | -|**platform** | [**PlatformEnum**](#PlatformEnum) | Restrict matches to this platform (multi-platform models only; matches all platforms if omitted). Rejected for single-architecture models. | [optional] | +|**includeUserDebug** | **Boolean** | When debug is set, also match user-named functions (not only auto/system debug). No effect unless debug is true. | [optional] | +|**platforms** | [**List<PlatformsEnum>**](#List<PlatformsEnum>) | Restrict matches to candidates whose binary was detected as one of these platforms. Matches all platforms if omitted; a binary whose detection has not run is never matched by a non-empty filter. | [optional] | |**userIds** | **List<Long>** | Restrict the candidate pool to functions owned by these user IDs. | [optional] | -## Enum: ArchEnum +## Enum: List<ArchitecturesEnum> | Name | Value | |---- | -----| -| X86 | "x86" | -| ARM | "arm" | -| UNKNOWN | "unknown" | +| X86_64 | "x86_64" | +| X86_32 | "x86_32" | +| ARM_64 | "arm_64" | | UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | -## Enum: PlatformEnum +## Enum: List<PlatformsEnum> | Name | Value | |---- | -----| -| LINUX | "linux" | | WINDOWS | "windows" | +| LINUX | "linux" | | ANDROID | "android" | -| MACOS | "macos" | -| UNKNOWN | "unknown" | | UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | diff --git a/docs/PointerDataType.md b/docs/PointerDataType.md new file mode 100644 index 00000000..c52f2388 --- /dev/null +++ b/docs/PointerDataType.md @@ -0,0 +1,43 @@ + + +# PointerDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**PointerDefinition**](PointerDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| POINTER | "POINTER" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ReplacementValue.md b/docs/PointerDefinition.md similarity index 56% rename from docs/ReplacementValue.md rename to docs/PointerDefinition.md index 8a293ca3..c5e73e36 100644 --- a/docs/ReplacementValue.md +++ b/docs/PointerDefinition.md @@ -1,13 +1,13 @@ -# ReplacementValue +# PointerDefinition ## Properties | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**value** | **String** | | | +|**pointeeDataTypeId** | **Long** | The type pointed at. | [optional] | diff --git a/docs/RenameUnnamedFunctionsResult.md b/docs/RenameUnnamedFunctionsResult.md new file mode 100644 index 00000000..4add69dd --- /dev/null +++ b/docs/RenameUnnamedFunctionsResult.md @@ -0,0 +1,17 @@ + + +# RenameUnnamedFunctionsResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**analysisId** | **Long** | Analysis the run was performed against | | +|**failed** | **Long** | Functions whose rename attempt errored | | +|**renamed** | **Long** | Functions successfully renamed | | +|**skipped** | **Long** | Functions the agent chose not to rename | | +|**total** | **Long** | Unnamed functions the run considered | | + + + diff --git a/docs/RenderedToken.md b/docs/RenderedToken.md new file mode 100644 index 00000000..227f7c97 --- /dev/null +++ b/docs/RenderedToken.md @@ -0,0 +1,38 @@ + + +# RenderedToken + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | Data type this token names, or for a field the type that declares it. Scoped by the response's analysis_id. | [optional] | +|**functionId** | **Long** | Function this token calls or names. Absent when the address reaches no function of this binary. | [optional] | +|**importedFunctionId** | **Long** | Imported function this token calls. Set instead of function_id for an external call. | [optional] | +|**kind** | [**KindEnum**](#KindEnum) | What the token names. | | +|**vaddr** | **Long** | Virtual address the token resolves to. Absent for a token with no address. | [optional] | +|**value** | **String** | Name the token resolves to. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| OWN_FUNCTION | "own_function" | +| FUNCTION | "function" | +| FUNCPTR | "funcptr" | +| TYPE | "type" | +| FIELD | "field" | +| PARAM | "param" | +| LOCAL | "local" | +| GLOBAL | "global" | +| ENUM | "enum" | +| LABEL | "label" | +| STRING | "string" | +| FLOAT | "float" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/ResolvedEntity.md b/docs/ResolvedEntity.md new file mode 100644 index 00000000..197077c5 --- /dev/null +++ b/docs/ResolvedEntity.md @@ -0,0 +1,60 @@ + + +# ResolvedEntity + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**addrToken** | **String** | | | +|**allAddrTokens** | **List<String>** | | | +|**bitOffset** | **Long** | | | +|**byteOffset** | **Long** | | | +|**byteSize** | **Long** | | | +|**count** | **Long** | | | +|**dataTypeIndex** | **Long** | | | +|**fieldStatus** | [**FieldStatusEnum**](#FieldStatusEnum) | | [optional] | +|**functionId** | **Long** | | [optional] | +|**importedFunctionId** | **Long** | | [optional] | +|**kind** | **String** | Search is applied to string value | | +|**name** | **String** | Search is applied to string value | | +|**nameSource** | [**NameSourceEnum**](#NameSourceEnum) | | | +|**needsNaming** | **Boolean** | | | +|**provenance** | **String** | Search is applied to string value | | +|**resolvedName** | **String** | | | +|**suggestedType** | **String** | | | +|**suggestionConfidence** | **String** | | | +|**token** | **String** | Search is applied to string value | | +|**typeIndex** | **Long** | | | +|**vaddr** | **Long** | | | +|**value** | **String** | | | +|**valueConfidence** | **String** | | | +|**valueType** | **String** | | | + + + +## Enum: FieldStatusEnum + +| Name | Value | +|---- | -----| +| BACKED | "backed" | +| UNBACKED | "unbacked" | +| UNMATCHED | "unmatched" | +| AMBIGUOUS | "ambiguous" | +| UNKEYED | "unkeyed" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: NameSourceEnum + +| Name | Value | +|---- | -----| +| DATABASE | "database" | +| FROZEN | "frozen" | +| DEFAULT | "default" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/SegmentInfo.md b/docs/SegmentInfo.md index 21a968be..e3d85d4b 100644 --- a/docs/SegmentInfo.md +++ b/docs/SegmentInfo.md @@ -2,7 +2,7 @@ # SegmentInfo -Represents the information about a segment. Attributes: name: The name of the segment. r: Determines if the segment has read permission. w: Determines if the segment has write permission. x: Determines if the segment has execute permission. start: The start address of the segment. end: The end address of the segment. +Represents the information about a segment. Attributes: name: The name of the segment. r: Determines if the segment has read permission. w: Determines if the segment has write permission. x: Determines if the segment has execute permission. start: The start address of the segment. end: The end address of the segment (inclusive). kind: Coarse classification of the segment: \"code\", \"data\", or \"other\". ## Properties @@ -14,6 +14,7 @@ Represents the information about a segment. Attributes: name: The name of t |**x** | **Boolean** | | [optional] | |**start** | **Integer** | | [optional] | |**end** | **Integer** | | [optional] | +|**kind** | **String** | | [optional] | diff --git a/docs/SignatureParameterEntry.md b/docs/SignatureParameterEntry.md new file mode 100644 index 00000000..6659f8a4 --- /dev/null +++ b/docs/SignatureParameterEntry.md @@ -0,0 +1,17 @@ + + +# SignatureParameterEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bitLength** | **Long** | Width in bits, when the parameter occupies less than its type's full size. | [optional] | +|**dataTypeId** | **Long** | The parameter's type, resolvable against the analysis data types list. Absent when the type could not be resolved. | [optional] | +|**name** | **String** | Parameter name, absent when the producer had none. | [optional] | +|**ordinal** | **Long** | Zero-based argument position. | | +|**storage** | [**SignatureStorageEntry**](SignatureStorageEntry.md) | Where the parameter is passed. | [optional] | + + + diff --git a/docs/SignatureParameterInput.md b/docs/SignatureParameterInput.md new file mode 100644 index 00000000..c9137085 --- /dev/null +++ b/docs/SignatureParameterInput.md @@ -0,0 +1,17 @@ + + +# SignatureParameterInput + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**bitLength** | **Long** | Width in bits, when the parameter occupies less than its type's full size. | [optional] | +|**dataTypeId** | **Long** | The parameter's type, which must belong to this analysis. Omit for an unresolved type. | [optional] | +|**name** | **String** | Parameter name. Omit for an unnamed parameter. | [optional] | +|**ordinal** | **Long** | Zero-based argument position. Must equal the parameter's index in the list. | | +|**storage** | [**SignatureStorageInput**](SignatureStorageInput.md) | Where the parameter is passed. | [optional] | + + + diff --git a/docs/SignatureStorageEntry.md b/docs/SignatureStorageEntry.md new file mode 100644 index 00000000..ca75ee5d --- /dev/null +++ b/docs/SignatureStorageEntry.md @@ -0,0 +1,14 @@ + + +# SignatureStorageEntry + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kind** | **String** | Storage class — typically reg, stack, mem or unknown. Not restricted to a fixed set. | [optional] | +|**location** | **String** | Register name or stack slot. | [optional] | + + + diff --git a/docs/SignatureStorageInput.md b/docs/SignatureStorageInput.md new file mode 100644 index 00000000..c121cb07 --- /dev/null +++ b/docs/SignatureStorageInput.md @@ -0,0 +1,14 @@ + + +# SignatureStorageInput + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**kind** | **String** | Storage class — typically reg, stack, mem or unknown. Not restricted to a fixed set. | [optional] | +|**location** | **String** | Register name or stack slot. | [optional] | + + + diff --git a/docs/StackVariable.md b/docs/StackVariable.md deleted file mode 100644 index 2e7c9b83..00000000 --- a/docs/StackVariable.md +++ /dev/null @@ -1,18 +0,0 @@ - - -# StackVariable - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this stack variable | [optional] | -|**offset** | **Integer** | Offset of the stack variable | | -|**name** | **String** | Name of the stack variable | | -|**type** | **String** | Data type of the stack variable | | -|**size** | **Integer** | Size of the stack variable in bytes | | -|**addr** | **Integer** | Memory address of the stack variable | | - - - diff --git a/docs/StatusBody.md b/docs/StatusBody.md new file mode 100644 index 00000000..94716588 --- /dev/null +++ b/docs/StatusBody.md @@ -0,0 +1,28 @@ + + +# StatusBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**errorMessage** | **String** | Why the run failed. Only set when status is FAILED. | [optional] | +|**logHistory** | **List<List<Object>>** | Progress messages the run recorded, oldest first. | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | Run status. UNINITIALISED means the agent has never been triggered for this analysis. | | + + + +## 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/StructDataType.md b/docs/StructDataType.md new file mode 100644 index 00000000..fbd5aff8 --- /dev/null +++ b/docs/StructDataType.md @@ -0,0 +1,43 @@ + + +# StructDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**StructDefinition**](StructDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| STRUCT | "STRUCT" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/StructDefinition.md b/docs/StructDefinition.md new file mode 100644 index 00000000..7bdda77b --- /dev/null +++ b/docs/StructDefinition.md @@ -0,0 +1,13 @@ + + +# StructDefinition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**members** | [**List<DataTypeMemberEntry>**](DataTypeMemberEntry.md) | The type's fields, in offset order. | | + + + diff --git a/docs/Structure.md b/docs/Structure.md deleted file mode 100644 index fee259b0..00000000 --- a/docs/Structure.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# Structure - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this structure | [optional] | -|**name** | **String** | Name of the structure | | -|**size** | **Integer** | Total size of the structure in bytes | [optional] | -|**members** | [**Map<String, StructureMember>**](StructureMember.md) | Dictionary of structure members | | -|**artifactType** | **String** | Type of artifact that the structure is associated with | [optional] | - - - diff --git a/docs/StructureMember.md b/docs/StructureMember.md deleted file mode 100644 index 43ec1c2c..00000000 --- a/docs/StructureMember.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# StructureMember - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this structure member | [optional] | -|**name** | **String** | Name of the structure member | | -|**offset** | **Integer** | Offset of the member within the structure | | -|**type** | **String** | Data type of the structure member | | -|**size** | **Integer** | Size of the structure member in bytes | | - - - diff --git a/docs/ListFunctionsDataTypesOutputBody.md b/docs/Token.md similarity index 51% rename from docs/ListFunctionsDataTypesOutputBody.md rename to docs/Token.md index baaef683..21d593b2 100644 --- a/docs/ListFunctionsDataTypesOutputBody.md +++ b/docs/Token.md @@ -1,13 +1,13 @@ -# ListFunctionsDataTypesOutputBody +# Token ## Properties | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**items** | [**List<DataTypesEntry>**](DataTypesEntry.md) | | | +|**value** | **String** | Name the token resolves to. An empty string in a request removes the override. | | diff --git a/docs/TokenisedData.md b/docs/TokenisedData.md index 7275b133..bbb67ca8 100644 --- a/docs/TokenisedData.md +++ b/docs/TokenisedData.md @@ -7,7 +7,8 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**functionMapping** | [**AIDecompFunctionMapping**](AIDecompFunctionMapping.md) | Complete mapping data for token resolution | [optional] | +|**entities** | [**List<ResolvedEntity>**](ResolvedEntity.md) | One entry per token in the tokenised source, with the name it resolves to and its hover metadata. | [optional] | +|**lineAttribution** | **Object** | | [optional] | |**predictedFunctionName** | **String** | Predicted function name from the AI model | [optional] | |**status** | [**StatusEnum**](#StatusEnum) | Task status | | |**tokenisedDecompilation** | **String** | Source code with placeholder tokens | [optional] | diff --git a/docs/TriggerRenameUnnamedFunctionsInputBody.md b/docs/TriggerRenameUnnamedFunctionsInputBody.md new file mode 100644 index 00000000..3ffaae54 --- /dev/null +++ b/docs/TriggerRenameUnnamedFunctionsInputBody.md @@ -0,0 +1,13 @@ + + +# TriggerRenameUnnamedFunctionsInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**limit** | **Long** | Stop after this many functions. Omit to process every unnamed function in the analysis. | [optional] | + + + diff --git a/docs/TypeDefinition.md b/docs/TypeDefinition.md deleted file mode 100644 index 3aa1e79a..00000000 --- a/docs/TypeDefinition.md +++ /dev/null @@ -1,16 +0,0 @@ - - -# TypeDefinition - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this type definition | [optional] | -|**name** | **String** | Name of the type definition | | -|**type** | **String** | Underlying type of the type definition | | -|**artifactType** | **String** | Type of artifact the type definition is associated with | [optional] | - - - diff --git a/docs/TypedefDataType.md b/docs/TypedefDataType.md new file mode 100644 index 00000000..c5e6175b --- /dev/null +++ b/docs/TypedefDataType.md @@ -0,0 +1,43 @@ + + +# TypedefDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**TypedefDefinition**](TypedefDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| TYPEDEF | "TYPEDEF" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/AIDecompInverseStringMapItem.md b/docs/TypedefDefinition.md similarity index 56% rename from docs/AIDecompInverseStringMapItem.md rename to docs/TypedefDefinition.md index b8d894c7..4b23e34d 100644 --- a/docs/AIDecompInverseStringMapItem.md +++ b/docs/TypedefDefinition.md @@ -1,14 +1,13 @@ -# AIDecompInverseStringMapItem +# TypedefDefinition ## Properties | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**addr** | **Long** | | | -|**string** | **String** | | | +|**targetDataTypeId** | **Long** | The type being aliased. | [optional] | diff --git a/docs/UnionDataType.md b/docs/UnionDataType.md new file mode 100644 index 00000000..92cb5c64 --- /dev/null +++ b/docs/UnionDataType.md @@ -0,0 +1,43 @@ + + +# UnionDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**definition** | [**UnionDefinition**](UnionDefinition.md) | Absent only for a type referenced but never defined. | [optional] | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNION | "UNION" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UnionDefinition.md b/docs/UnionDefinition.md new file mode 100644 index 00000000..580ec163 --- /dev/null +++ b/docs/UnionDefinition.md @@ -0,0 +1,13 @@ + + +# UnionDefinition + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**members** | [**List<DataTypeMemberEntry>**](DataTypeMemberEntry.md) | The type's fields. Every member starts at offset 0. | | + + + diff --git a/docs/UnknownDataType.md b/docs/UnknownDataType.md new file mode 100644 index 00000000..cbc7e94e --- /dev/null +++ b/docs/UnknownDataType.md @@ -0,0 +1,42 @@ + + +# UnknownDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**createdAt** | **OffsetDateTime** | When this type was extracted. | | +|**dataTypeId** | **Long** | Identifies the type within its analysis. 0 is a valid id. | | +|**hasDefinition** | **Boolean** | Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. | | +|**namespace** | **String** | The scope qualifying the type name. Empty for a program-defined type. | | +|**size** | **Long** | Size in bytes, absent when it could not be determined. | [optional] | +|**sourceFunctionId** | **Long** | The function this type was copied from, when transferred rather than extracted. | [optional] | +|**sourceType** | [**SourceTypeEnum**](#SourceTypeEnum) | Where this type came from. | | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNKNOWN | "UNKNOWN" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + +## Enum: SourceTypeEnum + +| Name | Value | +|---- | -----| +| SYSTEM | "SYSTEM" | +| USER | "USER" | +| AUTO_UNSTRIP | "AUTO_UNSTRIP" | +| AI_DECOMP | "AI_DECOMP" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateAnalysisDataTypesInputBody.md b/docs/UpdateAnalysisDataTypesInputBody.md new file mode 100644 index 00000000..300e5e21 --- /dev/null +++ b/docs/UpdateAnalysisDataTypesInputBody.md @@ -0,0 +1,13 @@ + + +# UpdateAnalysisDataTypesInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypes** | [**List<UpdateDataTypeEntry>**](UpdateDataTypeEntry.md) | The replacements. Every data_type_id must belong to the analysis, and none may repeat. | | + + + diff --git a/docs/UpdateArrayDataType.md b/docs/UpdateArrayDataType.md new file mode 100644 index 00000000..68d342bd --- /dev/null +++ b/docs/UpdateArrayDataType.md @@ -0,0 +1,27 @@ + + +# UpdateArrayDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**ArrayDefinition**](ArrayDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| ARRAY | "ARRAY" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateBaseDataType.md b/docs/UpdateBaseDataType.md new file mode 100644 index 00000000..c832e3fe --- /dev/null +++ b/docs/UpdateBaseDataType.md @@ -0,0 +1,26 @@ + + +# UpdateBaseDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| BASE | "BASE" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateBitfieldDataType.md b/docs/UpdateBitfieldDataType.md new file mode 100644 index 00000000..fc6fd707 --- /dev/null +++ b/docs/UpdateBitfieldDataType.md @@ -0,0 +1,26 @@ + + +# UpdateBitfieldDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| BITFIELD | "BITFIELD" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateDataTypeEntry.md b/docs/UpdateDataTypeEntry.md new file mode 100644 index 00000000..8d20b68b --- /dev/null +++ b/docs/UpdateDataTypeEntry.md @@ -0,0 +1,28 @@ + + +# UpdateDataTypeEntry + +A replacement for the data type named by `data_type_id`. `kind` selects the variant and so which definition the type must carry; changing it is allowed. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**FunctionTypeDefinition**](FunctionTypeDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNKNOWN | "UNKNOWN" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateDataTypesInputBody.md b/docs/UpdateDataTypesInputBody.md deleted file mode 100644 index 65210fc3..00000000 --- a/docs/UpdateDataTypesInputBody.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# UpdateDataTypesInputBody - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**dataTypes** | **Object** | | | -|**dataTypesVersion** | **Long** | Current version of the function data types. The update is rejected if the stored version has moved on. Pass 0 on the first write. | | - - - diff --git a/docs/UpdateDataTypesOutputBody.md b/docs/UpdateDataTypesOutputBody.md deleted file mode 100644 index 8f460951..00000000 --- a/docs/UpdateDataTypesOutputBody.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# UpdateDataTypesOutputBody - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**dataTypes** | **Object** | | | -|**dataTypesVersion** | **Long** | Version of the stored function data types after the update | | -|**functionId** | **Long** | Function ID | | - - - diff --git a/docs/UpdateEnumDataType.md b/docs/UpdateEnumDataType.md new file mode 100644 index 00000000..3c673f3f --- /dev/null +++ b/docs/UpdateEnumDataType.md @@ -0,0 +1,27 @@ + + +# UpdateEnumDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**EnumDefinition**](EnumDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| ENUM | "ENUM" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateFunctionDataType.md b/docs/UpdateFunctionDataType.md new file mode 100644 index 00000000..e065906d --- /dev/null +++ b/docs/UpdateFunctionDataType.md @@ -0,0 +1,27 @@ + + +# UpdateFunctionDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**FunctionTypeDefinition**](FunctionTypeDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| FUNCTION_DEFINITION | "FUNCTION_DEFINITION" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateFunctionSignatureInputBody.md b/docs/UpdateFunctionSignatureInputBody.md new file mode 100644 index 00000000..1b280a63 --- /dev/null +++ b/docs/UpdateFunctionSignatureInputBody.md @@ -0,0 +1,15 @@ + + +# UpdateFunctionSignatureInputBody + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callingConvention** | **String** | Calling convention. Omit when there is none to record. | [optional] | +|**parameters** | [**List<SignatureParameterInput>**](SignatureParameterInput.md) | Parameters in argument order. An empty list records a function that takes no arguments. | | +|**returnDataTypeId** | **Long** | Return type, which must belong to this analysis. Omit for an unresolved return type. | [optional] | + + + diff --git a/docs/UpdatePointerDataType.md b/docs/UpdatePointerDataType.md new file mode 100644 index 00000000..64778e4b --- /dev/null +++ b/docs/UpdatePointerDataType.md @@ -0,0 +1,27 @@ + + +# UpdatePointerDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**PointerDefinition**](PointerDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| POINTER | "POINTER" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateStructDataType.md b/docs/UpdateStructDataType.md new file mode 100644 index 00000000..ed854311 --- /dev/null +++ b/docs/UpdateStructDataType.md @@ -0,0 +1,27 @@ + + +# UpdateStructDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**StructDefinition**](StructDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| STRUCT | "STRUCT" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateTypedefDataType.md b/docs/UpdateTypedefDataType.md new file mode 100644 index 00000000..a3037331 --- /dev/null +++ b/docs/UpdateTypedefDataType.md @@ -0,0 +1,27 @@ + + +# UpdateTypedefDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**TypedefDefinition**](TypedefDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| TYPEDEF | "TYPEDEF" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateUnionDataType.md b/docs/UpdateUnionDataType.md new file mode 100644 index 00000000..32691b53 --- /dev/null +++ b/docs/UpdateUnionDataType.md @@ -0,0 +1,27 @@ + + +# UpdateUnionDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**definition** | [**UnionDefinition**](UnionDefinition.md) | | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNION | "UNION" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpdateUnknownDataType.md b/docs/UpdateUnknownDataType.md new file mode 100644 index 00000000..c271c38e --- /dev/null +++ b/docs/UpdateUnknownDataType.md @@ -0,0 +1,26 @@ + + +# UpdateUnknownDataType + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**dataTypeId** | **Long** | The type to replace, as returned by the data types list for this analysis. | | +|**kind** | [**KindEnum**](#KindEnum) | | | +|**name** | **String** | Type name. Unique within the analysis for a given namespace and kind. | | +|**namespace** | **String** | The scope qualifying the type name. Omit for a type of the binary's own. | [optional] | +|**size** | **Long** | Size in bytes. Omit when it is not known. | [optional] | + + + +## Enum: KindEnum + +| Name | Value | +|---- | -----| +| UNKNOWN | "UNKNOWN" | +| UNKNOWN_DEFAULT_OPEN_API | "unknown_default_open_api" | + + + diff --git a/docs/UpsertOverridesData.md b/docs/UpsertOverridesData.md index 4c0d7705..25ac7ad6 100644 --- a/docs/UpsertOverridesData.md +++ b/docs/UpsertOverridesData.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**userOverrideMappings** | **Map<String, String>** | Merged override mappings after applying changes | | +|**placeholderToUserOverride** | [**Map<String, Token>**](Token.md) | Every override on the function after applying this request, keyed by placeholder token. | | diff --git a/docs/UpsertOverridesInputBody.md b/docs/UpsertOverridesInputBody.md index 52446a34..1249eb85 100644 --- a/docs/UpsertOverridesInputBody.md +++ b/docs/UpsertOverridesInputBody.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**overrides** | **Map<String, String>** | Token to name mappings. Empty string removes the override. | | +|**overrides** | [**Map<String, Token>**](Token.md) | Overrides keyed by placeholder token. An entry whose value is an empty string removes that override. | | diff --git a/docs/V2FunctionHeader.md b/docs/V2FunctionHeader.md deleted file mode 100644 index 99d8b8e8..00000000 --- a/docs/V2FunctionHeader.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# V2FunctionHeader - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this function header | [optional] | -|**name** | **String** | Name of the function | | -|**addr** | **Integer** | Memory address of the function | | -|**type** | **String** | Return type of the function | | -|**args** | [**Map<String, Argument>**](Argument.md) | Dictionary of function arguments | | - - - diff --git a/docs/V2FunctionInfo.md b/docs/V2FunctionInfo.md deleted file mode 100644 index ff8ab546..00000000 --- a/docs/V2FunctionInfo.md +++ /dev/null @@ -1,14 +0,0 @@ - - -# V2FunctionInfo - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**funcTypes** | [**V2FunctionType**](V2FunctionType.md) | Function type information | [optional] | -|**funcDeps** | [**List<FuncDepsInner>**](FuncDepsInner.md) | List of function dependencies | | - - - diff --git a/docs/V2FunctionType.md b/docs/V2FunctionType.md deleted file mode 100644 index 6f6c0864..00000000 --- a/docs/V2FunctionType.md +++ /dev/null @@ -1,20 +0,0 @@ - - -# V2FunctionType - - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**lastChange** | **String** | Timestamp of the last change to this function type | [optional] | -|**addr** | **Integer** | Memory address of the function | | -|**size** | **Integer** | Size of the function in bytes | | -|**header** | [**V2FunctionHeader**](V2FunctionHeader.md) | Function header information | | -|**stackVars** | [**Map<String, StackVariable>**](StackVariable.md) | Dictionary of stack variables | [optional] | -|**name** | **String** | Name of the function | | -|**type** | **String** | Return type of the function | | -|**artifactType** | **String** | Type of artifact that the structure is associated with | [optional] | - - - diff --git a/pom.xml b/pom.xml index 74d48e07..693e1d50 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ sdk jar sdk - 3.131.1 + 4.4.0 https://github.com/RevEngAI/sdk-java Java SDK for the RevEng.AI API diff --git a/src/main/java/ai/reveng/api/AgentApi.java b/src/main/java/ai/reveng/api/AgentApi.java index c6875dd8..7b7d2214 100644 --- a/src/main/java/ai/reveng/api/AgentApi.java +++ b/src/main/java/ai/reveng/api/AgentApi.java @@ -26,6 +26,7 @@ import java.io.IOException; +import ai.reveng.model.APIError; import ai.reveng.model.BaseResponse; import ai.reveng.model.BaseResponseCapabilitiesAgentResponse; import ai.reveng.model.BaseResponseQueuedWorkflowTaskResponse; @@ -34,7 +35,10 @@ import ai.reveng.model.BaseResponseTriageReportResponse; import ai.reveng.model.ErrorModel; import ai.reveng.model.QueuedWorkflowTaskResponse; +import ai.reveng.model.RenameUnnamedFunctionsResult; +import ai.reveng.model.StatusBody; import ai.reveng.model.TaskStatusResponse; +import ai.reveng.model.TriggerRenameUnnamedFunctionsInputBody; import java.lang.reflect.Type; import java.util.ArrayList; @@ -1655,4 +1659,590 @@ public okhttp3.Call getTriageResultV2AnalysesAnalysisIdAgentTriageGetAsync(@java localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3CancelRenameUnnamedFunctions + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CancelRenameUnnamedFunctionsCall(@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}/agents/rename-unnamed-functions/cancel" + .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, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3CancelRenameUnnamedFunctionsValidateBeforeCall(@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 v3CancelRenameUnnamedFunctions(Async)"); + } + + return v3CancelRenameUnnamedFunctionsCall(analysisId, _callback); + + } + + /** + * Cancel the rename-unnamed-functions agent. + * Requests cancellation of the currently running rename-unnamed-functions run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + * @param analysisId Analysis ID (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public void v3CancelRenameUnnamedFunctions(@javax.annotation.Nonnull Long analysisId) throws ApiException { + v3CancelRenameUnnamedFunctionsWithHttpInfo(analysisId); + } + + /** + * Cancel the rename-unnamed-functions agent. + * Requests cancellation of the currently running rename-unnamed-functions run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + * @param analysisId Analysis ID (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3CancelRenameUnnamedFunctionsWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3CancelRenameUnnamedFunctionsValidateBeforeCall(analysisId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Cancel the rename-unnamed-functions agent. (asynchronously) + * Requests cancellation of the currently running rename-unnamed-functions run for the analysis. Returns 404 if no run is in progress. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NO_ACTIVE_RUN`](/errors/NO_ACTIVE_RUN) — No Active Run + * @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
204 No Content -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CancelRenameUnnamedFunctionsAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3CancelRenameUnnamedFunctionsValidateBeforeCall(analysisId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for v3GetRenameUnnamedFunctionsResult + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetRenameUnnamedFunctionsResultCall(@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}/agents/rename-unnamed-functions" + .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 v3GetRenameUnnamedFunctionsResultValidateBeforeCall(@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 v3GetRenameUnnamedFunctionsResult(Async)"); + } + + return v3GetRenameUnnamedFunctionsResultCall(analysisId, _callback); + + } + + /** + * Get rename-unnamed-functions agent result. + * Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + * @param analysisId Analysis ID (required) + * @return RenameUnnamedFunctionsResult + * @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 RenameUnnamedFunctionsResult v3GetRenameUnnamedFunctionsResult(@javax.annotation.Nonnull Long analysisId) throws ApiException { + ApiResponse localVarResp = v3GetRenameUnnamedFunctionsResultWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get rename-unnamed-functions agent result. + * Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + * @param analysisId Analysis ID (required) + * @return ApiResponse<RenameUnnamedFunctionsResult> + * @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 v3GetRenameUnnamedFunctionsResultWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3GetRenameUnnamedFunctionsResultValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get rename-unnamed-functions agent result. (asynchronously) + * Returns the summary of the most recent completed rename-unnamed-functions run. Returns 409 while a run is still in progress and 404 when the agent has never produced a result for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready + * @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 -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetRenameUnnamedFunctionsResultAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetRenameUnnamedFunctionsResultValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetRenameUnnamedFunctionsStatus + * @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 v3GetRenameUnnamedFunctionsStatusCall(@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}/agents/rename-unnamed-functions/status" + .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 v3GetRenameUnnamedFunctionsStatusValidateBeforeCall(@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 v3GetRenameUnnamedFunctionsStatus(Async)"); + } + + return v3GetRenameUnnamedFunctionsStatusCall(analysisId, _callback); + + } + + /** + * Get rename-unnamed-functions agent status. + * Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return StatusBody + * @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 StatusBody v3GetRenameUnnamedFunctionsStatus(@javax.annotation.Nonnull Long analysisId) throws ApiException { + ApiResponse localVarResp = v3GetRenameUnnamedFunctionsStatusWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get rename-unnamed-functions agent status. + * Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return ApiResponse<StatusBody> + * @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 v3GetRenameUnnamedFunctionsStatusWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3GetRenameUnnamedFunctionsStatusValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get rename-unnamed-functions agent status. (asynchronously) + * Returns the status of the most recent rename-unnamed-functions run for the analysis. `UNINITIALISED` means the agent has never been triggered, so it is safe to start one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetRenameUnnamedFunctionsStatusAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetRenameUnnamedFunctionsStatusValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3TriggerRenameUnnamedFunctions + * @param analysisId Analysis ID (required) + * @param triggerRenameUnnamedFunctionsInputBody (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
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3TriggerRenameUnnamedFunctionsCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerRenameUnnamedFunctionsInputBody triggerRenameUnnamedFunctionsInputBody, 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 = triggerRenameUnnamedFunctionsInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/agents/rename-unnamed-functions" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3TriggerRenameUnnamedFunctionsValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerRenameUnnamedFunctionsInputBody triggerRenameUnnamedFunctionsInputBody, 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 v3TriggerRenameUnnamedFunctions(Async)"); + } + + // verify the required parameter 'triggerRenameUnnamedFunctionsInputBody' is set + if (triggerRenameUnnamedFunctionsInputBody == null) { + throw new ApiException("Missing the required parameter 'triggerRenameUnnamedFunctionsInputBody' when calling v3TriggerRenameUnnamedFunctions(Async)"); + } + + return v3TriggerRenameUnnamedFunctionsCall(analysisId, triggerRenameUnnamedFunctionsInputBody, _callback); + + } + + /** + * Run the rename-unnamed-functions agent. + * Starts an agent that renames the analysis' unnamed functions from their AI decompilations. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `limit` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * @param analysisId Analysis ID (required) + * @param triggerRenameUnnamedFunctionsInputBody (required) + * @return StatusBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public StatusBody v3TriggerRenameUnnamedFunctions(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerRenameUnnamedFunctionsInputBody triggerRenameUnnamedFunctionsInputBody) throws ApiException { + ApiResponse localVarResp = v3TriggerRenameUnnamedFunctionsWithHttpInfo(analysisId, triggerRenameUnnamedFunctionsInputBody); + return localVarResp.getData(); + } + + /** + * Run the rename-unnamed-functions agent. + * Starts an agent that renames the analysis' unnamed functions from their AI decompilations. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `limit` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * @param analysisId Analysis ID (required) + * @param triggerRenameUnnamedFunctionsInputBody (required) + * @return ApiResponse<StatusBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3TriggerRenameUnnamedFunctionsWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerRenameUnnamedFunctionsInputBody triggerRenameUnnamedFunctionsInputBody) throws ApiException { + okhttp3.Call localVarCall = v3TriggerRenameUnnamedFunctionsValidateBeforeCall(analysisId, triggerRenameUnnamedFunctionsInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Run the rename-unnamed-functions agent. (asynchronously) + * Starts an agent that renames the analysis' unnamed functions from their AI decompilations. Each function costs an AI decompilation, so a whole-analysis run can be expensive — use `limit` to bound it. Returns 409 while a run is already in progress for this analysis. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * @param analysisId Analysis ID (required) + * @param triggerRenameUnnamedFunctionsInputBody (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
202 Accepted -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3TriggerRenameUnnamedFunctionsAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull TriggerRenameUnnamedFunctionsInputBody triggerRenameUnnamedFunctionsInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3TriggerRenameUnnamedFunctionsValidateBeforeCall(analysisId, triggerRenameUnnamedFunctionsInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } } diff --git a/src/main/java/ai/reveng/api/AnalysesCoreApi.java b/src/main/java/ai/reveng/api/AnalysesCoreApi.java index 3cdffa12..399d549a 100644 --- a/src/main/java/ai/reveng/api/AnalysesCoreApi.java +++ b/src/main/java/ai/reveng/api/AnalysesCoreApi.java @@ -51,6 +51,7 @@ import ai.reveng.model.DynamicExecutionStatus; import ai.reveng.model.DynamicExecutionStatusResponse; import java.io.File; +import ai.reveng.model.GetAnalysisLogsOutputBody; import ai.reveng.model.GetAnalysisStringsStatusOutputBody; import ai.reveng.model.GetMatchesOutputBody; import ai.reveng.model.GetMatchesStatusOutputBody; @@ -1439,7 +1440,9 @@ public okhttp3.Call getAnalysisFunctionMatchingStatusAsync(@javax.annotation.Non 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getAnalysisLogsCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers @@ -1485,6 +1488,7 @@ public okhttp3.Call getAnalysisLogsCall(@javax.annotation.Nonnull Integer analys return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } + @Deprecated @SuppressWarnings("rawtypes") private okhttp3.Call getAnalysisLogsValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'analysisId' is set @@ -1509,7 +1513,9 @@ private okhttp3.Call getAnalysisLogsValidateBeforeCall(@javax.annotation.Nonnull 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public BaseResponseLogs getAnalysisLogs(@javax.annotation.Nonnull Integer analysisId) throws ApiException { ApiResponse localVarResp = getAnalysisLogsWithHttpInfo(analysisId); return localVarResp.getData(); @@ -1528,7 +1534,9 @@ public BaseResponseLogs getAnalysisLogs(@javax.annotation.Nonnull Integer analys 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public ApiResponse getAnalysisLogsWithHttpInfo(@javax.annotation.Nonnull Integer analysisId) throws ApiException { okhttp3.Call localVarCall = getAnalysisLogsValidateBeforeCall(analysisId, null); Type localVarReturnType = new TypeToken(){}.getType(); @@ -1549,7 +1557,9 @@ public ApiResponse getAnalysisLogsWithHttpInfo(@javax.annotati 200 Successful Response - 422 Invalid request parameters - + * @deprecated */ + @Deprecated public okhttp3.Call getAnalysisLogsAsync(@javax.annotation.Nonnull Integer analysisId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getAnalysisLogsValidateBeforeCall(analysisId, _callback); @@ -3627,6 +3637,149 @@ public okhttp3.Call v3GetAnalysisAutoUnstripStatusAsync(@javax.annotation.Nonnul localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for v3GetAnalysisLogs + * @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 v3GetAnalysisLogsCall(@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}/logs" + .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 v3GetAnalysisLogsValidateBeforeCall(@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 v3GetAnalysisLogs(Async)"); + } + + return v3GetAnalysisLogsCall(analysisId, _callback); + + } + + /** + * Get the Analysis log + * Returns every log line recorded for the Analysis, oldest first, merged from every source that has written one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return GetAnalysisLogsOutputBody + * @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 GetAnalysisLogsOutputBody v3GetAnalysisLogs(@javax.annotation.Nonnull Long analysisId) throws ApiException { + ApiResponse localVarResp = v3GetAnalysisLogsWithHttpInfo(analysisId); + return localVarResp.getData(); + } + + /** + * Get the Analysis log + * Returns every log line recorded for the Analysis, oldest first, merged from every source that has written one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @return ApiResponse<GetAnalysisLogsOutputBody> + * @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 v3GetAnalysisLogsWithHttpInfo(@javax.annotation.Nonnull Long analysisId) throws ApiException { + okhttp3.Call localVarCall = v3GetAnalysisLogsValidateBeforeCall(analysisId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get the Analysis log (asynchronously) + * Returns every log line recorded for the Analysis, oldest first, merged from every source that has written one. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + * @param analysisId Analysis ID (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetAnalysisLogsAsync(@javax.annotation.Nonnull Long analysisId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAnalysisLogsValidateBeforeCall(analysisId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for v3GetAnalysisStrings * @param analysisId Analysis ID (required) diff --git a/src/main/java/ai/reveng/api/CollectionsApi.java b/src/main/java/ai/reveng/api/CollectionsApi.java index 1e8a2d8a..dcf8006d 100644 --- a/src/main/java/ai/reveng/api/CollectionsApi.java +++ b/src/main/java/ai/reveng/api/CollectionsApi.java @@ -1485,7 +1485,6 @@ public okhttp3.Call v3CreateCollectionAsync(@javax.annotation.Nonnull CreateColl 204 No Content - 403 Forbidden - 404 Not Found - - 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - @@ -1548,7 +1547,7 @@ private okhttp3.Call v3DeleteCollectionValidateBeforeCall(@javax.annotation.Nonn /** * Delete a collection. - * Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * Deletes a collection along with its binary links, tags, and hierarchy links. The binaries themselves are not deleted. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied * @param collectionId (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -1558,7 +1557,6 @@ private okhttp3.Call v3DeleteCollectionValidateBeforeCall(@javax.annotation.Nonn 204 No Content - 403 Forbidden - 404 Not Found - - 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - @@ -1569,7 +1567,7 @@ public void v3DeleteCollection(@javax.annotation.Nonnull Long collectionId) thro /** * Delete a collection. - * Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * Deletes a collection along with its binary links, tags, and hierarchy links. The binaries themselves are not deleted. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied * @param collectionId (required) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -1580,7 +1578,6 @@ public void v3DeleteCollection(@javax.annotation.Nonnull Long collectionId) thro 204 No Content - 403 Forbidden - 404 Not Found - - 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - @@ -1592,7 +1589,7 @@ public ApiResponse v3DeleteCollectionWithHttpInfo(@javax.annotation.Nonnul /** * Delete a collection. (asynchronously) - * Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + * Deletes a collection along with its binary links, tags, and hierarchy links. The binaries themselves are not deleted. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied * @param collectionId (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -1604,7 +1601,6 @@ public ApiResponse v3DeleteCollectionWithHttpInfo(@javax.annotation.Nonnul 204 No Content - 403 Forbidden - 404 Not Found - - 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - diff --git a/src/main/java/ai/reveng/api/DataTypesApi.java b/src/main/java/ai/reveng/api/DataTypesApi.java new file mode 100644 index 00000000..1bac6050 --- /dev/null +++ b/src/main/java/ai/reveng/api/DataTypesApi.java @@ -0,0 +1,1888 @@ +/* + * 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.api; + +import ai.reveng.invoker.ApiCallback; +import ai.reveng.invoker.ApiClient; +import ai.reveng.invoker.ApiException; +import ai.reveng.invoker.ApiResponse; +import ai.reveng.invoker.Configuration; +import ai.reveng.invoker.Pair; +import ai.reveng.invoker.ProgressRequestBody; +import ai.reveng.invoker.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import ai.reveng.model.APIError; +import ai.reveng.model.AnalysisDataTypesOutputBody; +import ai.reveng.model.CopyFunctionSignaturesInputBody; +import ai.reveng.model.CopyFunctionSignaturesOutputBody; +import ai.reveng.model.CreateAnalysisDataTypesInputBody; +import ai.reveng.model.DataTypeEntry; +import ai.reveng.model.FunctionSignatureBody; +import ai.reveng.model.FunctionSignatureEntry; +import ai.reveng.model.GetDataTypeHistoryBody; +import ai.reveng.model.GetFunctionSignatureHistoryBody; +import ai.reveng.model.ListAnalysisDataTypesOutputBody; +import ai.reveng.model.ListDataTypeFunctionsBody; +import ai.reveng.model.ListFunctionSignaturesOutputBody; +import ai.reveng.model.UpdateAnalysisDataTypesInputBody; +import ai.reveng.model.UpdateFunctionSignatureInputBody; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class DataTypesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DataTypesApi() { + this(Configuration.getDefaultApiClient()); + } + + public DataTypesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for v3CopyFunctionSignatures + * @param analysisId Analysis ID (required) + * @param copyFunctionSignaturesInputBody (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CopyFunctionSignaturesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CopyFunctionSignaturesInputBody copyFunctionSignaturesInputBody, 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 = copyFunctionSignaturesInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/signatures/copy" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3CopyFunctionSignaturesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CopyFunctionSignaturesInputBody copyFunctionSignaturesInputBody, 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 v3CopyFunctionSignatures(Async)"); + } + + // verify the required parameter 'copyFunctionSignaturesInputBody' is set + if (copyFunctionSignaturesInputBody == null) { + throw new ApiException("Missing the required parameter 'copyFunctionSignaturesInputBody' when calling v3CopyFunctionSignatures(Async)"); + } + + return v3CopyFunctionSignaturesCall(analysisId, copyFunctionSignaturesInputBody, _callback); + + } + + /** + * Copy function signatures + * Replaces each target function's signature with a copy of its source's parameters, return type and calling convention. Every target must belong to this analysis; a source may belong to any analysis the caller can read. The whole request is rejected if any pair is invalid. A `data_type_id` means nothing outside the analysis that issued it, so the types a copied signature needs are resolved against this analysis by namespace, name and kind. A type this analysis already has under that key has its definition replaced by the source's; a type it lacks is created. Copied signatures get a `source_type` of `USER` and a `source_function_id`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param copyFunctionSignaturesInputBody (required) + * @return CopyFunctionSignaturesOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public CopyFunctionSignaturesOutputBody v3CopyFunctionSignatures(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CopyFunctionSignaturesInputBody copyFunctionSignaturesInputBody) throws ApiException { + ApiResponse localVarResp = v3CopyFunctionSignaturesWithHttpInfo(analysisId, copyFunctionSignaturesInputBody); + return localVarResp.getData(); + } + + /** + * Copy function signatures + * Replaces each target function's signature with a copy of its source's parameters, return type and calling convention. Every target must belong to this analysis; a source may belong to any analysis the caller can read. The whole request is rejected if any pair is invalid. A `data_type_id` means nothing outside the analysis that issued it, so the types a copied signature needs are resolved against this analysis by namespace, name and kind. A type this analysis already has under that key has its definition replaced by the source's; a type it lacks is created. Copied signatures get a `source_type` of `USER` and a `source_function_id`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param copyFunctionSignaturesInputBody (required) + * @return ApiResponse<CopyFunctionSignaturesOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3CopyFunctionSignaturesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CopyFunctionSignaturesInputBody copyFunctionSignaturesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3CopyFunctionSignaturesValidateBeforeCall(analysisId, copyFunctionSignaturesInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Copy function signatures (asynchronously) + * Replaces each target function's signature with a copy of its source's parameters, return type and calling convention. Every target must belong to this analysis; a source may belong to any analysis the caller can read. The whole request is rejected if any pair is invalid. A `data_type_id` means nothing outside the analysis that issued it, so the types a copied signature needs are resolved against this analysis by namespace, name and kind. A type this analysis already has under that key has its definition replaced by the source's; a type it lacks is created. Copied signatures get a `source_type` of `USER` and a `source_function_id`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param copyFunctionSignaturesInputBody (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CopyFunctionSignaturesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CopyFunctionSignaturesInputBody copyFunctionSignaturesInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3CopyFunctionSignaturesValidateBeforeCall(analysisId, copyFunctionSignaturesInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3CreateAnalysisDataTypes + * @param analysisId Analysis ID (required) + * @param createAnalysisDataTypesInputBody (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
201 Created -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CreateAnalysisDataTypesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CreateAnalysisDataTypesInputBody createAnalysisDataTypesInputBody, 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 = createAnalysisDataTypesInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/data-types" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3CreateAnalysisDataTypesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CreateAnalysisDataTypesInputBody createAnalysisDataTypesInputBody, 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 v3CreateAnalysisDataTypes(Async)"); + } + + // verify the required parameter 'createAnalysisDataTypesInputBody' is set + if (createAnalysisDataTypesInputBody == null) { + throw new ApiException("Missing the required parameter 'createAnalysisDataTypesInputBody' when calling v3CreateAnalysisDataTypes(Async)"); + } + + return v3CreateAnalysisDataTypesCall(analysisId, createAnalysisDataTypesInputBody, _callback); + + } + + /** + * Create an analysis's data types + * Adds user-authored types to an analysis. Many types can be created in one request; the whole request is rejected if any of them is invalid. Ids are assigned by the server and returned here. Stored types get a `source_type` of `USER`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param createAnalysisDataTypesInputBody (required) + * @return AnalysisDataTypesOutputBody + * @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 -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public AnalysisDataTypesOutputBody v3CreateAnalysisDataTypes(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CreateAnalysisDataTypesInputBody createAnalysisDataTypesInputBody) throws ApiException { + ApiResponse localVarResp = v3CreateAnalysisDataTypesWithHttpInfo(analysisId, createAnalysisDataTypesInputBody); + return localVarResp.getData(); + } + + /** + * Create an analysis's data types + * Adds user-authored types to an analysis. Many types can be created in one request; the whole request is rejected if any of them is invalid. Ids are assigned by the server and returned here. Stored types get a `source_type` of `USER`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param createAnalysisDataTypesInputBody (required) + * @return ApiResponse<AnalysisDataTypesOutputBody> + * @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 -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3CreateAnalysisDataTypesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CreateAnalysisDataTypesInputBody createAnalysisDataTypesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3CreateAnalysisDataTypesValidateBeforeCall(analysisId, createAnalysisDataTypesInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create an analysis's data types (asynchronously) + * Adds user-authored types to an analysis. Many types can be created in one request; the whole request is rejected if any of them is invalid. Ids are assigned by the server and returned here. Stored types get a `source_type` of `USER`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param createAnalysisDataTypesInputBody (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
201 Created -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3CreateAnalysisDataTypesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull CreateAnalysisDataTypesInputBody createAnalysisDataTypesInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3CreateAnalysisDataTypesValidateBeforeCall(analysisId, createAnalysisDataTypesInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetAnalysisDataType + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid 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 v3GetAnalysisDataTypeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, 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}/data-types/{data_type_id}" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .replace("{" + "data_type_id" + "}", localVarApiClient.escapeString(dataTypeId.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 v3GetAnalysisDataTypeValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, 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 v3GetAnalysisDataType(Async)"); + } + + // verify the required parameter 'dataTypeId' is set + if (dataTypeId == null) { + throw new ApiException("Missing the required parameter 'dataTypeId' when calling v3GetAnalysisDataType(Async)"); + } + + return v3GetAnalysisDataTypeCall(analysisId, dataTypeId, _callback); + + } + + /** + * Get one of an analysis's data types + * Returns a single data type by its `data_type_id`, byte-identical to the entry the data types list returns for it — same variant, same fields, same definition — so a client can cache and invalidate rows from either endpoint interchangeably. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @return DataTypeEntry + * @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 DataTypeEntry v3GetAnalysisDataType(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId) throws ApiException { + ApiResponse localVarResp = v3GetAnalysisDataTypeWithHttpInfo(analysisId, dataTypeId); + return localVarResp.getData(); + } + + /** + * Get one of an analysis's data types + * Returns a single data type by its `data_type_id`, byte-identical to the entry the data types list returns for it — same variant, same fields, same definition — so a client can cache and invalidate rows from either endpoint interchangeably. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @return ApiResponse<DataTypeEntry> + * @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 v3GetAnalysisDataTypeWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId) throws ApiException { + okhttp3.Call localVarCall = v3GetAnalysisDataTypeValidateBeforeCall(analysisId, dataTypeId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get one of an analysis's data types (asynchronously) + * Returns a single data type by its `data_type_id`, byte-identical to the entry the data types list returns for it — same variant, same fields, same definition — so a client can cache and invalidate rows from either endpoint interchangeably. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid 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 v3GetAnalysisDataTypeAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAnalysisDataTypeValidateBeforeCall(analysisId, dataTypeId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetAnalysisDataTypeHistory + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid 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 v3GetAnalysisDataTypeHistoryCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, 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}/data-types/{data_type_id}/history" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .replace("{" + "data_type_id" + "}", localVarApiClient.escapeString(dataTypeId.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 v3GetAnalysisDataTypeHistoryValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, 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 v3GetAnalysisDataTypeHistory(Async)"); + } + + // verify the required parameter 'dataTypeId' is set + if (dataTypeId == null) { + throw new ApiException("Missing the required parameter 'dataTypeId' when calling v3GetAnalysisDataTypeHistory(Async)"); + } + + return v3GetAnalysisDataTypeHistoryCall(analysisId, dataTypeId, _callback); + + } + + /** + * Get a data type's edit history + * The versions a data type has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @return GetDataTypeHistoryBody + * @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 GetDataTypeHistoryBody v3GetAnalysisDataTypeHistory(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId) throws ApiException { + ApiResponse localVarResp = v3GetAnalysisDataTypeHistoryWithHttpInfo(analysisId, dataTypeId); + return localVarResp.getData(); + } + + /** + * Get a data type's edit history + * The versions a data type has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @return ApiResponse<GetDataTypeHistoryBody> + * @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 v3GetAnalysisDataTypeHistoryWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId) throws ApiException { + okhttp3.Call localVarCall = v3GetAnalysisDataTypeHistoryValidateBeforeCall(analysisId, dataTypeId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a data type's edit history (asynchronously) + * The versions a data type has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid 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 v3GetAnalysisDataTypeHistoryAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAnalysisDataTypeHistoryValidateBeforeCall(analysisId, dataTypeId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetFunctionSignature + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param includeDataTypes Include the data types the signature names in the response. (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
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetFunctionSignatureCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean includeDataTypes, 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}/functions/{function_id}/signature" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (includeDataTypes != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include_data_types", includeDataTypes)); + } + + 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 v3GetFunctionSignatureValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean includeDataTypes, 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 v3GetFunctionSignature(Async)"); + } + + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException("Missing the required parameter 'functionId' when calling v3GetFunctionSignature(Async)"); + } + + return v3GetFunctionSignatureCall(analysisId, functionId, includeDataTypes, _callback); + + } + + /** + * Get a function's signature + * Returns the extracted signature for one function: its parameters, return type and calling convention. Pass `include_data_types=true` to also get the data types it names. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param includeDataTypes Include the data types the signature names in the response. (optional) + * @return FunctionSignatureBody + * @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 FunctionSignatureBody v3GetFunctionSignature(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean includeDataTypes) throws ApiException { + ApiResponse localVarResp = v3GetFunctionSignatureWithHttpInfo(analysisId, functionId, includeDataTypes); + return localVarResp.getData(); + } + + /** + * Get a function's signature + * Returns the extracted signature for one function: its parameters, return type and calling convention. Pass `include_data_types=true` to also get the data types it names. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param includeDataTypes Include the data types the signature names in the response. (optional) + * @return ApiResponse<FunctionSignatureBody> + * @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 v3GetFunctionSignatureWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean includeDataTypes) throws ApiException { + okhttp3.Call localVarCall = v3GetFunctionSignatureValidateBeforeCall(analysisId, functionId, includeDataTypes, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a function's signature (asynchronously) + * Returns the extracted signature for one function: its parameters, return type and calling convention. Pass `include_data_types=true` to also get the data types it names. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param includeDataTypes Include the data types the signature names in the response. (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
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3GetFunctionSignatureAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean includeDataTypes, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetFunctionSignatureValidateBeforeCall(analysisId, functionId, includeDataTypes, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetFunctionSignatureHistory + * @param analysisId Analysis ID (required) + * @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 v3GetFunctionSignatureHistoryCall(@javax.annotation.Nonnull Long analysisId, @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/analyses/{analysis_id}/functions/{function_id}/signature/history" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .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 v3GetFunctionSignatureHistoryValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, 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 v3GetFunctionSignatureHistory(Async)"); + } + + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException("Missing the required parameter 'functionId' when calling v3GetFunctionSignatureHistory(Async)"); + } + + return v3GetFunctionSignatureHistoryCall(analysisId, functionId, _callback); + + } + + /** + * Get a function signature's edit history + * The versions a function's signature has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @return GetFunctionSignatureHistoryBody + * @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 GetFunctionSignatureHistoryBody v3GetFunctionSignatureHistory(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId) throws ApiException { + ApiResponse localVarResp = v3GetFunctionSignatureHistoryWithHttpInfo(analysisId, functionId); + return localVarResp.getData(); + } + + /** + * Get a function signature's edit history + * The versions a function's signature has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @return ApiResponse<GetFunctionSignatureHistoryBody> + * @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 v3GetFunctionSignatureHistoryWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId) throws ApiException { + okhttp3.Call localVarCall = v3GetFunctionSignatureHistoryValidateBeforeCall(analysisId, functionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a function signature's edit history (asynchronously) + * The versions a function's signature has held, newest first, each attributed to the edit that wrote it. The first value is the current value. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * @param analysisId Analysis ID (required) + * @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 v3GetFunctionSignatureHistoryAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetFunctionSignatureHistoryValidateBeforeCall(analysisId, functionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3ListAnalysisDataTypes + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. (optional, default to 0) + * @param limit Page size. (optional, default to 100) + * @param kind Only return types of these kinds. Repeat for more than one; empty means no filter. (optional) + * @param namespace Only return types in these namespaces, matched exactly. Omit for no filter; pass an empty value (namespace=) for the binary's own types, which have no namespace. (optional) + * @param search Only return types whose name contains this term. Wildcards in the term are matched literally. (optional) + * @param sourceType Only return types from these sources. Empty means no filter. (optional) + * @param orderBy Field to order by. name orders by namespace, then name, then kind; size orders by size with types of unknown size last, then by namespace, name and kind. (optional, default to name) + * @param order Sort direction. (optional, default to ASC) + * @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 v3ListAnalysisDataTypesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable List kind, @javax.annotation.Nullable List namespace, @javax.annotation.Nullable String search, @javax.annotation.Nullable List sourceType, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, 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}/data-types" + .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(); + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (kind != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "kind", kind)); + } + + if (namespace != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "namespace", namespace)); + } + + if (search != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("search", search)); + } + + if (sourceType != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "source_type", sourceType)); + } + + if (orderBy != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("order_by", orderBy)); + } + + if (order != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("order", order)); + } + + 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 v3ListAnalysisDataTypesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable List kind, @javax.annotation.Nullable List namespace, @javax.annotation.Nullable String search, @javax.annotation.Nullable List sourceType, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, 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 v3ListAnalysisDataTypes(Async)"); + } + + return v3ListAnalysisDataTypesCall(analysisId, offset, limit, kind, namespace, search, sourceType, orderBy, order, _callback); + + } + + /** + * List an analysis's data types + * Paginated, filterable list of the data types extracted from the binary — structs, unions, enums, typedefs and the rest. Every entry carries its full definition, so paging this list once resolves every `data_type_id` a definition or signature refers to; no follow-up request per id is needed. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. (optional, default to 0) + * @param limit Page size. (optional, default to 100) + * @param kind Only return types of these kinds. Repeat for more than one; empty means no filter. (optional) + * @param namespace Only return types in these namespaces, matched exactly. Omit for no filter; pass an empty value (namespace=) for the binary's own types, which have no namespace. (optional) + * @param search Only return types whose name contains this term. Wildcards in the term are matched literally. (optional) + * @param sourceType Only return types from these sources. Empty means no filter. (optional) + * @param orderBy Field to order by. name orders by namespace, then name, then kind; size orders by size with types of unknown size last, then by namespace, name and kind. (optional, default to name) + * @param order Sort direction. (optional, default to ASC) + * @return ListAnalysisDataTypesOutputBody + * @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 ListAnalysisDataTypesOutputBody v3ListAnalysisDataTypes(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable List kind, @javax.annotation.Nullable List namespace, @javax.annotation.Nullable String search, @javax.annotation.Nullable List sourceType, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { + ApiResponse localVarResp = v3ListAnalysisDataTypesWithHttpInfo(analysisId, offset, limit, kind, namespace, search, sourceType, orderBy, order); + return localVarResp.getData(); + } + + /** + * List an analysis's data types + * Paginated, filterable list of the data types extracted from the binary — structs, unions, enums, typedefs and the rest. Every entry carries its full definition, so paging this list once resolves every `data_type_id` a definition or signature refers to; no follow-up request per id is needed. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. (optional, default to 0) + * @param limit Page size. (optional, default to 100) + * @param kind Only return types of these kinds. Repeat for more than one; empty means no filter. (optional) + * @param namespace Only return types in these namespaces, matched exactly. Omit for no filter; pass an empty value (namespace=) for the binary's own types, which have no namespace. (optional) + * @param search Only return types whose name contains this term. Wildcards in the term are matched literally. (optional) + * @param sourceType Only return types from these sources. Empty means no filter. (optional) + * @param orderBy Field to order by. name orders by namespace, then name, then kind; size orders by size with types of unknown size last, then by namespace, name and kind. (optional, default to name) + * @param order Sort direction. (optional, default to ASC) + * @return ApiResponse<ListAnalysisDataTypesOutputBody> + * @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 v3ListAnalysisDataTypesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable List kind, @javax.annotation.Nullable List namespace, @javax.annotation.Nullable String search, @javax.annotation.Nullable List sourceType, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order) throws ApiException { + okhttp3.Call localVarCall = v3ListAnalysisDataTypesValidateBeforeCall(analysisId, offset, limit, kind, namespace, search, sourceType, orderBy, order, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List an analysis's data types (asynchronously) + * Paginated, filterable list of the data types extracted from the binary — structs, unions, enums, typedefs and the rest. Every entry carries its full definition, so paging this list once resolves every `data_type_id` a definition or signature refers to; no follow-up request per id is needed. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param offset Pagination offset. (optional, default to 0) + * @param limit Page size. (optional, default to 100) + * @param kind Only return types of these kinds. Repeat for more than one; empty means no filter. (optional) + * @param namespace Only return types in these namespaces, matched exactly. Omit for no filter; pass an empty value (namespace=) for the binary's own types, which have no namespace. (optional) + * @param search Only return types whose name contains this term. Wildcards in the term are matched literally. (optional) + * @param sourceType Only return types from these sources. Empty means no filter. (optional) + * @param orderBy Field to order by. name orders by namespace, then name, then kind; size orders by size with types of unknown size last, then by namespace, name and kind. (optional, default to name) + * @param order Sort direction. (optional, default to ASC) + * @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 v3ListAnalysisDataTypesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, @javax.annotation.Nullable List kind, @javax.annotation.Nullable List namespace, @javax.annotation.Nullable String search, @javax.annotation.Nullable List sourceType, @javax.annotation.Nullable String orderBy, @javax.annotation.Nullable String order, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3ListAnalysisDataTypesValidateBeforeCall(analysisId, offset, limit, kind, namespace, search, sourceType, orderBy, order, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3ListDataTypeFunctions + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @param pageSize Page size. (optional, default to 50) + * @param afterFunctionId Return functions with an ID greater than this. Pass the previous page's next_after_function_id; 0 starts at the first function. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListDataTypeFunctionsCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable Long afterFunctionId, 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}/data-types/{data_type_id}/functions" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .replace("{" + "data_type_id" + "}", localVarApiClient.escapeString(dataTypeId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize)); + } + + if (afterFunctionId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("after_function_id", afterFunctionId)); + } + + 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 v3ListDataTypeFunctionsValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable Long afterFunctionId, 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 v3ListDataTypeFunctions(Async)"); + } + + // verify the required parameter 'dataTypeId' is set + if (dataTypeId == null) { + throw new ApiException("Missing the required parameter 'dataTypeId' when calling v3ListDataTypeFunctions(Async)"); + } + + return v3ListDataTypeFunctionsCall(analysisId, dataTypeId, pageSize, afterFunctionId, _callback); + + } + + /** + * List the functions using a data type + * Functions that use this data type as their return type or as a parameter. Matches the `data_type_id` exactly as it appears in the signature, so a function taking `sockaddr_in *` matches the pointer type rather than `sockaddr_in`. Ordered by function ID. There is no total count; page with `after_function_id`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @param pageSize Page size. (optional, default to 50) + * @param afterFunctionId Return functions with an ID greater than this. Pass the previous page's next_after_function_id; 0 starts at the first function. (optional, default to 0) + * @return ListDataTypeFunctionsBody + * @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 ListDataTypeFunctionsBody v3ListDataTypeFunctions(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable Long afterFunctionId) throws ApiException { + ApiResponse localVarResp = v3ListDataTypeFunctionsWithHttpInfo(analysisId, dataTypeId, pageSize, afterFunctionId); + return localVarResp.getData(); + } + + /** + * List the functions using a data type + * Functions that use this data type as their return type or as a parameter. Matches the `data_type_id` exactly as it appears in the signature, so a function taking `sockaddr_in *` matches the pointer type rather than `sockaddr_in`. Ordered by function ID. There is no total count; page with `after_function_id`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @param pageSize Page size. (optional, default to 50) + * @param afterFunctionId Return functions with an ID greater than this. Pass the previous page's next_after_function_id; 0 starts at the first function. (optional, default to 0) + * @return ApiResponse<ListDataTypeFunctionsBody> + * @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 v3ListDataTypeFunctionsWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable Long afterFunctionId) throws ApiException { + okhttp3.Call localVarCall = v3ListDataTypeFunctionsValidateBeforeCall(analysisId, dataTypeId, pageSize, afterFunctionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List the functions using a data type (asynchronously) + * Functions that use this data type as their return type or as a parameter. Matches the `data_type_id` exactly as it appears in the signature, so a function taking `sockaddr_in *` matches the pointer type rather than `sockaddr_in`. Ordered by function ID. There is no total count; page with `after_function_id`. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param dataTypeId Data type ID, as returned by the data types list for this analysis. 0 is a valid id. (required) + * @param pageSize Page size. (optional, default to 50) + * @param afterFunctionId Return functions with an ID greater than this. Pass the previous page's next_after_function_id; 0 starts at the first function. (optional, default to 0) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListDataTypeFunctionsAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long dataTypeId, @javax.annotation.Nullable Long pageSize, @javax.annotation.Nullable Long afterFunctionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3ListDataTypeFunctionsValidateBeforeCall(analysisId, dataTypeId, pageSize, afterFunctionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3ListFunctionSignatures + * @param functionIds Function IDs to fetch signatures for. (required) + * @param includeDataTypes Include the data types the signatures name in the response. (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
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListFunctionSignaturesCall(@javax.annotation.Nullable List functionIds, @javax.annotation.Nullable Boolean includeDataTypes, 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/signatures"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (functionIds != null) { + localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "function_ids", functionIds)); + } + + if (includeDataTypes != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("include_data_types", includeDataTypes)); + } + + 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 v3ListFunctionSignaturesValidateBeforeCall(@javax.annotation.Nullable List functionIds, @javax.annotation.Nullable Boolean includeDataTypes, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'functionIds' is set + if (functionIds == null) { + throw new ApiException("Missing the required parameter 'functionIds' when calling v3ListFunctionSignatures(Async)"); + } + + return v3ListFunctionSignaturesCall(functionIds, includeDataTypes, _callback); + + } + + /** + * Get signatures for many functions + * Returns the extracted signature for each supplied function ID, in request order. The functions need not share an analysis; each entry names the analysis its `data_type_id`s resolve against. Pass `include_data_types=true` to also get those data types, grouped by analysis. The caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param functionIds Function IDs to fetch signatures for. (required) + * @param includeDataTypes Include the data types the signatures name in the response. (optional) + * @return ListFunctionSignaturesOutputBody + * @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 ListFunctionSignaturesOutputBody v3ListFunctionSignatures(@javax.annotation.Nullable List functionIds, @javax.annotation.Nullable Boolean includeDataTypes) throws ApiException { + ApiResponse localVarResp = v3ListFunctionSignaturesWithHttpInfo(functionIds, includeDataTypes); + return localVarResp.getData(); + } + + /** + * Get signatures for many functions + * Returns the extracted signature for each supplied function ID, in request order. The functions need not share an analysis; each entry names the analysis its `data_type_id`s resolve against. Pass `include_data_types=true` to also get those data types, grouped by analysis. The caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param functionIds Function IDs to fetch signatures for. (required) + * @param includeDataTypes Include the data types the signatures name in the response. (optional) + * @return ApiResponse<ListFunctionSignaturesOutputBody> + * @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 v3ListFunctionSignaturesWithHttpInfo(@javax.annotation.Nullable List functionIds, @javax.annotation.Nullable Boolean includeDataTypes) throws ApiException { + okhttp3.Call localVarCall = v3ListFunctionSignaturesValidateBeforeCall(functionIds, includeDataTypes, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get signatures for many functions (asynchronously) + * Returns the extracted signature for each supplied function ID, in request order. The functions need not share an analysis; each entry names the analysis its `data_type_id`s resolve against. Pass `include_data_types=true` to also get those data types, grouped by analysis. The caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param functionIds Function IDs to fetch signatures for. (required) + * @param includeDataTypes Include the data types the signatures name in the response. (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
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3ListFunctionSignaturesAsync(@javax.annotation.Nullable List functionIds, @javax.annotation.Nullable Boolean includeDataTypes, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3ListFunctionSignaturesValidateBeforeCall(functionIds, includeDataTypes, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3UpdateAnalysisDataTypes + * @param analysisId Analysis ID (required) + * @param updateAnalysisDataTypesInputBody (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpdateAnalysisDataTypesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateAnalysisDataTypesInputBody updateAnalysisDataTypesInputBody, 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 = updateAnalysisDataTypesInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/data-types" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3UpdateAnalysisDataTypesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateAnalysisDataTypesInputBody updateAnalysisDataTypesInputBody, 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 v3UpdateAnalysisDataTypes(Async)"); + } + + // verify the required parameter 'updateAnalysisDataTypesInputBody' is set + if (updateAnalysisDataTypesInputBody == null) { + throw new ApiException("Missing the required parameter 'updateAnalysisDataTypesInputBody' when calling v3UpdateAnalysisDataTypes(Async)"); + } + + return v3UpdateAnalysisDataTypesCall(analysisId, updateAnalysisDataTypesInputBody, _callback); + + } + + /** + * Update an analysis's data types + * Replaces stored types in full: a field left out of the request is cleared. Many types can be updated in one request; the whole request is rejected if any of them is invalid. `kind` may be changed, and the definition must then match the new kind. Updated types get a `source_type` of `USER`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param updateAnalysisDataTypesInputBody (required) + * @return AnalysisDataTypesOutputBody + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public AnalysisDataTypesOutputBody v3UpdateAnalysisDataTypes(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateAnalysisDataTypesInputBody updateAnalysisDataTypesInputBody) throws ApiException { + ApiResponse localVarResp = v3UpdateAnalysisDataTypesWithHttpInfo(analysisId, updateAnalysisDataTypesInputBody); + return localVarResp.getData(); + } + + /** + * Update an analysis's data types + * Replaces stored types in full: a field left out of the request is cleared. Many types can be updated in one request; the whole request is rejected if any of them is invalid. `kind` may be changed, and the definition must then match the new kind. Updated types get a `source_type` of `USER`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param updateAnalysisDataTypesInputBody (required) + * @return ApiResponse<AnalysisDataTypesOutputBody> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3UpdateAnalysisDataTypesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateAnalysisDataTypesInputBody updateAnalysisDataTypesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3UpdateAnalysisDataTypesValidateBeforeCall(analysisId, updateAnalysisDataTypesInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update an analysis's data types (asynchronously) + * Replaces stored types in full: a field left out of the request is cleared. Many types can be updated in one request; the whole request is rejected if any of them is invalid. `kind` may be changed, and the definition must then match the new kind. Updated types get a `source_type` of `USER`, and their previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param updateAnalysisDataTypesInputBody (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpdateAnalysisDataTypesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull UpdateAnalysisDataTypesInputBody updateAnalysisDataTypesInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3UpdateAnalysisDataTypesValidateBeforeCall(analysisId, updateAnalysisDataTypesInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3UpdateFunctionSignature + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param updateFunctionSignatureInputBody (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpdateFunctionSignatureCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateFunctionSignatureInputBody updateFunctionSignatureInputBody, 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 = updateFunctionSignatureInputBody; + + // create path and map variables + String localVarPath = "/v3/analyses/{analysis_id}/functions/{function_id}/signature" + .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) + .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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call v3UpdateFunctionSignatureValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateFunctionSignatureInputBody updateFunctionSignatureInputBody, 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 v3UpdateFunctionSignature(Async)"); + } + + // verify the required parameter 'functionId' is set + if (functionId == null) { + throw new ApiException("Missing the required parameter 'functionId' when calling v3UpdateFunctionSignature(Async)"); + } + + // verify the required parameter 'updateFunctionSignatureInputBody' is set + if (updateFunctionSignatureInputBody == null) { + throw new ApiException("Missing the required parameter 'updateFunctionSignatureInputBody' when calling v3UpdateFunctionSignature(Async)"); + } + + return v3UpdateFunctionSignatureCall(analysisId, functionId, updateFunctionSignatureInputBody, _callback); + + } + + /** + * Update a function's signature + * Replaces a function's parameters, return type and calling convention in full — anything left out of the request is cleared. Parameter and return types are `data_type_id`s belonging to this analysis. Edits an extracted signature only: a function with `has_signature` false is rejected with 404. The stored signature gets a `source_type` of `USER`, and its previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param updateFunctionSignatureInputBody (required) + * @return FunctionSignatureEntry + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public FunctionSignatureEntry v3UpdateFunctionSignature(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateFunctionSignatureInputBody updateFunctionSignatureInputBody) throws ApiException { + ApiResponse localVarResp = v3UpdateFunctionSignatureWithHttpInfo(analysisId, functionId, updateFunctionSignatureInputBody); + return localVarResp.getData(); + } + + /** + * Update a function's signature + * Replaces a function's parameters, return type and calling convention in full — anything left out of the request is cleared. Parameter and return types are `data_type_id`s belonging to this analysis. Edits an extracted signature only: a function with `has_signature` false is rejected with 404. The stored signature gets a `source_type` of `USER`, and its previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param updateFunctionSignatureInputBody (required) + * @return ApiResponse<FunctionSignatureEntry> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public ApiResponse v3UpdateFunctionSignatureWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateFunctionSignatureInputBody updateFunctionSignatureInputBody) throws ApiException { + okhttp3.Call localVarCall = v3UpdateFunctionSignatureValidateBeforeCall(analysisId, functionId, updateFunctionSignatureInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update a function's signature (asynchronously) + * Replaces a function's parameters, return type and calling convention in full — anything left out of the request is cleared. Parameter and return types are `data_type_id`s belonging to this analysis. Edits an extracted signature only: a function with `has_signature` false is rejected with 404. The stored signature gets a `source_type` of `USER`, and its previous value is retained. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + * @param analysisId Analysis ID (required) + * @param functionId Function ID (required) + * @param updateFunctionSignatureInputBody (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
+ */ + public okhttp3.Call v3UpdateFunctionSignatureAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateFunctionSignatureInputBody updateFunctionSignatureInputBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3UpdateFunctionSignatureValidateBeforeCall(analysisId, functionId, updateFunctionSignatureInputBody, _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 82b61009..fdbbbf8e 100644 --- a/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java +++ b/src/main/java/ai/reveng/api/FunctionsAiDecompilationApi.java @@ -32,11 +32,12 @@ import ai.reveng.model.CommentsData; import ai.reveng.model.CreateAIDecompOutputBody; import ai.reveng.model.DecompilationData; +import ai.reveng.model.GetTokensResponse; +import ai.reveng.model.LineAttributionsData; import ai.reveng.model.PatchCommentBody; import ai.reveng.model.RegenerateOutputBody; import ai.reveng.model.ServerSentEventsInner1; import ai.reveng.model.SummaryData; -import ai.reveng.model.TokenisedData; import ai.reveng.model.UpsertAiDecomplationRatingRequest; import ai.reveng.model.UpsertOverridesData; import ai.reveng.model.UpsertOverridesInputBody; @@ -88,7 +89,6 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createAiDecompilation * @param functionId Function ID (required) - * @param contextAware Use context-aware decompilation (optional, default to false) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @param _callback Callback for upload/download progress * @return Call to execute @@ -106,7 +106,7 @@ public void setCustomBaseUrl(String customBaseUrl) { 500 Internal Server Error - */ - public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean contextAware, @javax.annotation.Nullable Double temperature, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -132,10 +132,6 @@ public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long fun Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - if (contextAware != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("context_aware", contextAware)); - } - if (temperature != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("temperature", temperature)); } @@ -160,13 +156,13 @@ public okhttp3.Call createAiDecompilationCall(@javax.annotation.Nonnull Long fun } @SuppressWarnings("rawtypes") - private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean contextAware, @javax.annotation.Nullable Double temperature, final ApiCallback _callback) throws ApiException { + private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, final ApiCallback _callback) throws ApiException { // verify the required parameter 'functionId' is set if (functionId == null) { throw new ApiException("Missing the required parameter 'functionId' when calling createAiDecompilation(Async)"); } - return createAiDecompilationCall(functionId, contextAware, temperature, _callback); + return createAiDecompilationCall(functionId, temperature, _callback); } @@ -174,7 +170,6 @@ private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.N * Start AI decompilation * Begins the AI decompilation process for a function. Charges team credits and starts the workflow. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `402` [`INSUFFICIENT_CREDITS`](/errors/INSUFFICIENT_CREDITS) — Insufficient Credits * @param functionId Function ID (required) - * @param contextAware Use context-aware decompilation (optional, default to false) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @return CreateAIDecompOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -191,8 +186,8 @@ private okhttp3.Call createAiDecompilationValidateBeforeCall(@javax.annotation.N 500 Internal Server Error - */ - public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean contextAware, @javax.annotation.Nullable Double temperature) throws ApiException { - ApiResponse localVarResp = createAiDecompilationWithHttpInfo(functionId, contextAware, temperature); + public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature) throws ApiException { + ApiResponse localVarResp = createAiDecompilationWithHttpInfo(functionId, temperature); return localVarResp.getData(); } @@ -200,7 +195,6 @@ public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull * Start AI decompilation * Begins the AI decompilation process for a function. Charges team credits and starts the workflow. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `402` [`INSUFFICIENT_CREDITS`](/errors/INSUFFICIENT_CREDITS) — Insufficient Credits * @param functionId Function ID (required) - * @param contextAware Use context-aware decompilation (optional, default to false) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @return ApiResponse<CreateAIDecompOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -217,8 +211,8 @@ public CreateAIDecompOutputBody createAiDecompilation(@javax.annotation.Nonnull 500 Internal Server Error - */ - public ApiResponse createAiDecompilationWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean contextAware, @javax.annotation.Nullable Double temperature) throws ApiException { - okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, contextAware, temperature, null); + public ApiResponse createAiDecompilationWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature) throws ApiException { + okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, temperature, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } @@ -227,7 +221,6 @@ public ApiResponse createAiDecompilationWithHttpInfo(@ * Start AI decompilation (asynchronously) * Begins the AI decompilation process for a function. Charges team credits and starts the workflow. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - `402` [`INSUFFICIENT_CREDITS`](/errors/INSUFFICIENT_CREDITS) — Insufficient Credits * @param functionId Function ID (required) - * @param contextAware Use context-aware decompilation (optional, default to false) * @param temperature LLM temperature (0.0-1.0). Overrides the server default when set. Omit or set to -1 to use the server default. (optional, default to -1) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -245,9 +238,9 @@ public ApiResponse createAiDecompilationWithHttpInfo(@ 500 Internal Server Error - */ - public okhttp3.Call createAiDecompilationAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Boolean contextAware, @javax.annotation.Nullable Double temperature, final ApiCallback _callback) throws ApiException { + public okhttp3.Call createAiDecompilationAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nullable Double temperature, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, contextAware, temperature, _callback); + okhttp3.Call localVarCall = createAiDecompilationValidateBeforeCall(functionId, temperature, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; @@ -1394,149 +1387,6 @@ public okhttp3.Call getAiDecompilationSummaryStatusAsync(@javax.annotation.Nonnu localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } - /** - * Build call for getAiDecompilationTokenised - * @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 getAiDecompilationTokenisedCall(@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/tokenised" - .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 getAiDecompilationTokenisedValidateBeforeCall(@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 getAiDecompilationTokenised(Async)"); - } - - return getAiDecompilationTokenisedCall(functionId, _callback); - - } - - /** - * Get tokenised AI decompilation with function mapping - * Returns the decompilation with placeholder tokens, the function mapping for token resolution, and the predicted function name. **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 TokenisedData - * @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 TokenisedData getAiDecompilationTokenised(@javax.annotation.Nonnull Long functionId) throws ApiException { - ApiResponse localVarResp = getAiDecompilationTokenisedWithHttpInfo(functionId); - return localVarResp.getData(); - } - - /** - * Get tokenised AI decompilation with function mapping - * Returns the decompilation with placeholder tokens, the function mapping for token resolution, and the predicted function name. **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<TokenisedData> - * @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 getAiDecompilationTokenisedWithHttpInfo(@javax.annotation.Nonnull Long functionId) throws ApiException { - okhttp3.Call localVarCall = getAiDecompilationTokenisedValidateBeforeCall(functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get tokenised AI decompilation with function mapping (asynchronously) - * Returns the decompilation with placeholder tokens, the function mapping for token resolution, and the predicted function name. **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 getAiDecompilationTokenisedAsync(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getAiDecompilationTokenisedValidateBeforeCall(functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } /** * Build call for patchAiDecompilationInlineComment * @param functionId Function ID (required) @@ -2109,9 +1959,149 @@ public okhttp3.Call streamAiDecompilationAsync(@javax.annotation.Nonnull Long fu return localVarCall; } /** - * Build call for upsertAiDecompilationOverrides + * Build call for upsertAiDecompilationRating + * @param functionId The ID of the function being rated (required) + * @param upsertAiDecomplationRatingRequest (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
201 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call upsertAiDecompilationRatingCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest, 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 = upsertAiDecomplationRatingRequest; + + // create path and map variables + String localVarPath = "/v2/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 upsertAiDecompilationRatingValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest, 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 upsertAiDecompilationRating(Async)"); + } + + // verify the required parameter 'upsertAiDecomplationRatingRequest' is set + if (upsertAiDecomplationRatingRequest == null) { + throw new ApiException("Missing the required parameter 'upsertAiDecomplationRatingRequest' when calling upsertAiDecompilationRating(Async)"); + } + + return upsertAiDecompilationRatingCall(functionId, upsertAiDecomplationRatingRequest, _callback); + + } + + /** + * Upsert rating for AI decompilation + * + * @param functionId The ID of the function being rated (required) + * @param upsertAiDecomplationRatingRequest (required) + * @return BaseResponse + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public BaseResponse upsertAiDecompilationRating(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest) throws ApiException { + ApiResponse localVarResp = upsertAiDecompilationRatingWithHttpInfo(functionId, upsertAiDecomplationRatingRequest); + return localVarResp.getData(); + } + + /** + * Upsert rating for AI decompilation + * + * @param functionId The ID of the function being rated (required) + * @param upsertAiDecomplationRatingRequest (required) + * @return ApiResponse<BaseResponse> + * @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 Successful Response -
422 Invalid request parameters -
+ */ + public ApiResponse upsertAiDecompilationRatingWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest) throws ApiException { + okhttp3.Call localVarCall = upsertAiDecompilationRatingValidateBeforeCall(functionId, upsertAiDecomplationRatingRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Upsert rating for AI decompilation (asynchronously) + * + * @param functionId The ID of the function being rated (required) + * @param upsertAiDecomplationRatingRequest (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
201 Successful Response -
422 Invalid request parameters -
+ */ + public okhttp3.Call upsertAiDecompilationRatingAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = upsertAiDecompilationRatingValidateBeforeCall(functionId, upsertAiDecomplationRatingRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetAiDecompilationLineAttributions * @param functionId Function ID (required) - * @param upsertOverridesInputBody (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2120,14 +2110,13 @@ public okhttp3.Call streamAiDecompilationAsync(@javax.annotation.Nonnull Long fu Response Details Status Code Description Response Headers 200 OK - - 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public okhttp3.Call upsertAiDecompilationOverridesCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v3GetAiDecompilationLineAttributionsCall(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -2141,10 +2130,10 @@ public okhttp3.Call upsertAiDecompilationOverridesCall(@javax.annotation.Nonnull basePath = null; } - Object localVarPostBody = upsertOverridesInputBody; + Object localVarPostBody = null; // create path and map variables - String localVarPath = "/v3/functions/{function_id}/ai-decompilation/overrides" + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/line-attributions" .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); List localVarQueryParams = new ArrayList(); @@ -2162,7 +2151,6 @@ public okhttp3.Call upsertAiDecompilationOverridesCall(@javax.annotation.Nonnull } final String[] localVarContentTypes = { - "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { @@ -2170,79 +2158,212 @@ public okhttp3.Call upsertAiDecompilationOverridesCall(@javax.annotation.Nonnull } String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call upsertAiDecompilationOverridesValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody, final ApiCallback _callback) throws ApiException { + private okhttp3.Call v3GetAiDecompilationLineAttributionsValidateBeforeCall(@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 upsertAiDecompilationOverrides(Async)"); + throw new ApiException("Missing the required parameter 'functionId' when calling v3GetAiDecompilationLineAttributions(Async)"); } - // verify the required parameter 'upsertOverridesInputBody' is set - if (upsertOverridesInputBody == null) { - throw new ApiException("Missing the required parameter 'upsertOverridesInputBody' when calling upsertAiDecompilationOverrides(Async)"); + return v3GetAiDecompilationLineAttributionsCall(functionId, _callback); + + } + + /** + * Get AI decompilation line attributions + * Returns the correspondence between the function's disassembly line numbers and its AI-decompilation line numbers, grouped by disassembly line. Both sides are 0-indexed and the correspondence has a many-to-many relationship. The mapping is empty until a completed run has produced one, and is empty for a run that produced none. **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 LineAttributionsData + * @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 LineAttributionsData v3GetAiDecompilationLineAttributions(@javax.annotation.Nonnull Long functionId) throws ApiException { + ApiResponse localVarResp = v3GetAiDecompilationLineAttributionsWithHttpInfo(functionId); + return localVarResp.getData(); + } + + /** + * Get AI decompilation line attributions + * Returns the correspondence between the function's disassembly line numbers and its AI-decompilation line numbers, grouped by disassembly line. Both sides are 0-indexed and the correspondence has a many-to-many relationship. The mapping is empty until a completed run has produced one, and is empty for a run that produced none. **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<LineAttributionsData> + * @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 v3GetAiDecompilationLineAttributionsWithHttpInfo(@javax.annotation.Nonnull Long functionId) throws ApiException { + okhttp3.Call localVarCall = v3GetAiDecompilationLineAttributionsValidateBeforeCall(functionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get AI decompilation line attributions (asynchronously) + * Returns the correspondence between the function's disassembly line numbers and its AI-decompilation line numbers, grouped by disassembly line. Both sides are 0-indexed and the correspondence has a many-to-many relationship. The mapping is empty until a completed run has produced one, and is empty for a run that produced none. **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 v3GetAiDecompilationLineAttributionsAsync(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v3GetAiDecompilationLineAttributionsValidateBeforeCall(functionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for v3GetAiDecompilationTokens + * @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 v3GetAiDecompilationTokensCall(@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; } - return upsertAiDecompilationOverridesCall(functionId, upsertOverridesInputBody, _callback); + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/tokens" + .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 v3GetAiDecompilationTokensValidateBeforeCall(@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 v3GetAiDecompilationTokens(Async)"); + } + + return v3GetAiDecompilationTokensCall(functionId, _callback); } /** - * Upsert variable/function name overrides - * Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + * Get AI decompilation tokens and user overrides + * Returns the tokenised AI-decompilation source, the value each token resolves to, and the user's overrides as a separate unmerged map. The source is empty and the overrides are null until a run has succeeded. **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 upsertOverridesInputBody (required) - * @return UpsertOverridesData + * @return GetTokensResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
*/ - public UpsertOverridesData upsertAiDecompilationOverrides(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody) throws ApiException { - ApiResponse localVarResp = upsertAiDecompilationOverridesWithHttpInfo(functionId, upsertOverridesInputBody); + public GetTokensResponse v3GetAiDecompilationTokens(@javax.annotation.Nonnull Long functionId) throws ApiException { + ApiResponse localVarResp = v3GetAiDecompilationTokensWithHttpInfo(functionId); return localVarResp.getData(); } /** - * Upsert variable/function name overrides - * Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + * Get AI decompilation tokens and user overrides + * Returns the tokenised AI-decompilation source, the value each token resolves to, and the user's overrides as a separate unmerged map. The source is empty and the overrides are null until a run has succeeded. **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 upsertOverridesInputBody (required) - * @return ApiResponse<UpsertOverridesData> + * @return ApiResponse<GetTokensResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
*/ - public ApiResponse upsertAiDecompilationOverridesWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody) throws ApiException { - okhttp3.Call localVarCall = upsertAiDecompilationOverridesValidateBeforeCall(functionId, upsertOverridesInputBody, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse v3GetAiDecompilationTokensWithHttpInfo(@javax.annotation.Nonnull Long functionId) throws ApiException { + okhttp3.Call localVarCall = v3GetAiDecompilationTokensValidateBeforeCall(functionId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Upsert variable/function name overrides (asynchronously) - * Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + * Get AI decompilation tokens and user overrides (asynchronously) + * Returns the tokenised AI-decompilation source, the value each token resolves to, and the user's overrides as a separate unmerged map. The source is empty and the overrides are null until a run has succeeded. **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 upsertOverridesInputBody (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 @@ -2251,24 +2372,23 @@ public ApiResponse upsertAiDecompilationOverridesWithHttpIn Response Details Status Code Description Response Headers 200 OK - - 400 Bad Request - 403 Forbidden - 404 Not Found - 422 Unprocessable Entity - 500 Internal Server Error - */ - public okhttp3.Call upsertAiDecompilationOverridesAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v3GetAiDecompilationTokensAsync(@javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = upsertAiDecompilationOverridesValidateBeforeCall(functionId, upsertOverridesInputBody, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = v3GetAiDecompilationTokensValidateBeforeCall(functionId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** - * Build call for upsertAiDecompilationRating - * @param functionId The ID of the function being rated (required) - * @param upsertAiDecomplationRatingRequest (required) + * Build call for v3UpsertAiDecompilationOverrides + * @param functionId Function ID (required) + * @param upsertOverridesInputBody (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2276,11 +2396,15 @@ public okhttp3.Call upsertAiDecompilationOverridesAsync(@javax.annotation.Nonnul - - + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Invalid request parameters -
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
*/ - public okhttp3.Call upsertAiDecompilationRatingCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v3UpsertAiDecompilationOverridesCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -2294,10 +2418,10 @@ public okhttp3.Call upsertAiDecompilationRatingCall(@javax.annotation.Nonnull Lo basePath = null; } - Object localVarPostBody = upsertAiDecomplationRatingRequest; + Object localVarPostBody = upsertOverridesInputBody; // create path and map variables - String localVarPath = "/v2/functions/{function_id}/ai-decompilation/rating" + String localVarPath = "/v3/functions/{function_id}/ai-decompilation/overrides" .replace("{" + "function_id" + "}", localVarApiClient.escapeString(functionId.toString())); List localVarQueryParams = new ArrayList(); @@ -2327,67 +2451,75 @@ public okhttp3.Call upsertAiDecompilationRatingCall(@javax.annotation.Nonnull Lo } @SuppressWarnings("rawtypes") - private okhttp3.Call upsertAiDecompilationRatingValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest, final ApiCallback _callback) throws ApiException { + private okhttp3.Call v3UpsertAiDecompilationOverridesValidateBeforeCall(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody, 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 upsertAiDecompilationRating(Async)"); + throw new ApiException("Missing the required parameter 'functionId' when calling v3UpsertAiDecompilationOverrides(Async)"); } - // verify the required parameter 'upsertAiDecomplationRatingRequest' is set - if (upsertAiDecomplationRatingRequest == null) { - throw new ApiException("Missing the required parameter 'upsertAiDecomplationRatingRequest' when calling upsertAiDecompilationRating(Async)"); + // verify the required parameter 'upsertOverridesInputBody' is set + if (upsertOverridesInputBody == null) { + throw new ApiException("Missing the required parameter 'upsertOverridesInputBody' when calling v3UpsertAiDecompilationOverrides(Async)"); } - return upsertAiDecompilationRatingCall(functionId, upsertAiDecomplationRatingRequest, _callback); + return v3UpsertAiDecompilationOverridesCall(functionId, upsertOverridesInputBody, _callback); } /** - * Upsert rating for AI decompilation - * - * @param functionId The ID of the function being rated (required) - * @param upsertAiDecomplationRatingRequest (required) - * @return BaseResponse + * Upsert variable/function name overrides + * Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param upsertOverridesInputBody (required) + * @return UpsertOverridesData * @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 Successful Response -
422 Invalid request parameters -
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
*/ - public BaseResponse upsertAiDecompilationRating(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest) throws ApiException { - ApiResponse localVarResp = upsertAiDecompilationRatingWithHttpInfo(functionId, upsertAiDecomplationRatingRequest); + public UpsertOverridesData v3UpsertAiDecompilationOverrides(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody) throws ApiException { + ApiResponse localVarResp = v3UpsertAiDecompilationOverridesWithHttpInfo(functionId, upsertOverridesInputBody); return localVarResp.getData(); } /** - * Upsert rating for AI decompilation - * - * @param functionId The ID of the function being rated (required) - * @param upsertAiDecomplationRatingRequest (required) - * @return ApiResponse<BaseResponse> + * Upsert variable/function name overrides + * Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param upsertOverridesInputBody (required) + * @return ApiResponse<UpsertOverridesData> * @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 Successful Response -
422 Invalid request parameters -
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
*/ - public ApiResponse upsertAiDecompilationRatingWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest) throws ApiException { - okhttp3.Call localVarCall = upsertAiDecompilationRatingValidateBeforeCall(functionId, upsertAiDecomplationRatingRequest, null); - Type localVarReturnType = new TypeToken(){}.getType(); + public ApiResponse v3UpsertAiDecompilationOverridesWithHttpInfo(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody) throws ApiException { + okhttp3.Call localVarCall = v3UpsertAiDecompilationOverridesValidateBeforeCall(functionId, upsertOverridesInputBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Upsert rating for AI decompilation (asynchronously) - * - * @param functionId The ID of the function being rated (required) - * @param upsertAiDecomplationRatingRequest (required) + * Upsert variable/function name overrides (asynchronously) + * Applies user-provided name overrides to placeholder tokens in the decompilation. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `500` [`INTERNAL_ERROR`](/errors/INTERNAL_ERROR) — Internal Server Error + * @param functionId Function ID (required) + * @param upsertOverridesInputBody (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 @@ -2395,14 +2527,18 @@ public ApiResponse upsertAiDecompilationRatingWithHttpInfo(@javax. - - + + + + + +
Response Details
Status Code Description Response Headers
201 Successful Response -
422 Invalid request parameters -
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
*/ - public okhttp3.Call upsertAiDecompilationRatingAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertAiDecomplationRatingRequest upsertAiDecomplationRatingRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v3UpsertAiDecompilationOverridesAsync(@javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpsertOverridesInputBody upsertOverridesInputBody, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = upsertAiDecompilationRatingValidateBeforeCall(functionId, upsertAiDecomplationRatingRequest, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); + okhttp3.Call localVarCall = v3UpsertAiDecompilationOverridesValidateBeforeCall(functionId, upsertOverridesInputBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/ai/reveng/api/FunctionsCoreApi.java b/src/main/java/ai/reveng/api/FunctionsCoreApi.java index fa15ebe8..99a7974d 100644 --- a/src/main/java/ai/reveng/api/FunctionsCoreApi.java +++ b/src/main/java/ai/reveng/api/FunctionsCoreApi.java @@ -892,6 +892,7 @@ public okhttp3.Call getFunctionBlocksAsync(@javax.annotation.Nonnull Integer fun 200 OK - 403 Forbidden - 404 Not Found - + 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - @@ -954,7 +955,7 @@ private okhttp3.Call getFunctionBlocks_0ValidateBeforeCall(@javax.annotation.Non /** * Get function disassembly - * Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. A function that carries no disassembly (externals, thunks) returns 200 with the block fields omitted; disassembly that exists but cannot be read yet returns 409 ANALYSIS_NOT_READY. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready * @param functionId Function ID (required) * @return DisassemblyOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -965,6 +966,7 @@ private okhttp3.Call getFunctionBlocks_0ValidateBeforeCall(@javax.annotation.Non 200 OK - 403 Forbidden - 404 Not Found - + 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - @@ -976,7 +978,7 @@ public DisassemblyOutputBody getFunctionBlocks_0(@javax.annotation.Nonnull Long /** * Get function disassembly - * Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. A function that carries no disassembly (externals, thunks) returns 200 with the block fields omitted; disassembly that exists but cannot be read yet returns 409 ANALYSIS_NOT_READY. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready * @param functionId Function ID (required) * @return ApiResponse<DisassemblyOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -987,6 +989,7 @@ public DisassemblyOutputBody getFunctionBlocks_0(@javax.annotation.Nonnull Long 200 OK - 403 Forbidden - 404 Not Found - + 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - @@ -999,7 +1002,7 @@ public ApiResponse getFunctionBlocks_0WithHttpInfo(@javax /** * Get function disassembly (asynchronously) - * Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + * Returns the function's disassembly metadata (JSON blob containing basic blocks + local variables) along with parameter and return-type info. A function that carries no disassembly (externals, thunks) returns 200 with the block fields omitted; disassembly that exists but cannot be read yet returns 409 ANALYSIS_NOT_READY. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `409` [`ANALYSIS_NOT_READY`](/errors/ANALYSIS_NOT_READY) — Analysis Not Ready * @param functionId Function ID (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -1011,6 +1014,7 @@ public ApiResponse getFunctionBlocks_0WithHttpInfo(@javax 200 OK - 403 Forbidden - 404 Not Found - + 409 Conflict - 422 Unprocessable Entity - 500 Internal Server Error - diff --git a/src/main/java/ai/reveng/api/FunctionsDataTypesApi.java b/src/main/java/ai/reveng/api/FunctionsDataTypesApi.java deleted file mode 100644 index bd8e5aae..00000000 --- a/src/main/java/ai/reveng/api/FunctionsDataTypesApi.java +++ /dev/null @@ -1,1434 +0,0 @@ -/* - * 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.api; - -import ai.reveng.invoker.ApiCallback; -import ai.reveng.invoker.ApiClient; -import ai.reveng.invoker.ApiException; -import ai.reveng.invoker.ApiResponse; -import ai.reveng.invoker.Configuration; -import ai.reveng.invoker.Pair; -import ai.reveng.invoker.ProgressRequestBody; -import ai.reveng.invoker.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import ai.reveng.model.APIError; -import ai.reveng.model.BaseResponse; -import ai.reveng.model.BaseResponseFunctionDataTypesList; -import ai.reveng.model.BaseResponseGenerateFunctionDataTypes; -import ai.reveng.model.BaseResponseGenerationStatusList; -import ai.reveng.model.BatchUpdateDataTypesInputBody; -import ai.reveng.model.BatchUpdateDataTypesOutputBody; -import ai.reveng.model.DataTypesEntry; -import ai.reveng.model.FunctionDataTypesParams; -import ai.reveng.model.ListAnalysisFunctionsDataTypesOutputBody; -import ai.reveng.model.ListFunctionsDataTypesOutputBody; -import ai.reveng.model.UpdateDataTypesInputBody; -import ai.reveng.model.UpdateDataTypesOutputBody; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FunctionsDataTypesApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public FunctionsDataTypesApi() { - this(Configuration.getDefaultApiClient()); - } - - public FunctionsDataTypesApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for batchUpdateFunctionDataTypes - * @param analysisId Analysis ID (required) - * @param batchUpdateDataTypesInputBody (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call batchUpdateFunctionDataTypesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull BatchUpdateDataTypesInputBody batchUpdateDataTypesInputBody, 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 = batchUpdateDataTypesInputBody; - - // create path and map variables - String localVarPath = "/v3/analyses/{analysis_id}/functions/data-types" - .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call batchUpdateFunctionDataTypesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull BatchUpdateDataTypesInputBody batchUpdateDataTypesInputBody, 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 batchUpdateFunctionDataTypes(Async)"); - } - - // verify the required parameter 'batchUpdateDataTypesInputBody' is set - if (batchUpdateDataTypesInputBody == null) { - throw new ApiException("Missing the required parameter 'batchUpdateDataTypesInputBody' when calling batchUpdateFunctionDataTypes(Async)"); - } - - return batchUpdateFunctionDataTypesCall(analysisId, batchUpdateDataTypesInputBody, _callback); - - } - - /** - * Batch update function data types - * Updates data types for multiple functions in one analysis. All function IDs in the body must belong to the analysis. Each item is processed independently and reports its own outcome: a stale `data_types_version` yields `version_conflict` for that item without affecting the rest of the batch. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param analysisId Analysis ID (required) - * @param batchUpdateDataTypesInputBody (required) - * @return BatchUpdateDataTypesOutputBody - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public BatchUpdateDataTypesOutputBody batchUpdateFunctionDataTypes(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull BatchUpdateDataTypesInputBody batchUpdateDataTypesInputBody) throws ApiException { - ApiResponse localVarResp = batchUpdateFunctionDataTypesWithHttpInfo(analysisId, batchUpdateDataTypesInputBody); - return localVarResp.getData(); - } - - /** - * Batch update function data types - * Updates data types for multiple functions in one analysis. All function IDs in the body must belong to the analysis. Each item is processed independently and reports its own outcome: a stale `data_types_version` yields `version_conflict` for that item without affecting the rest of the batch. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param analysisId Analysis ID (required) - * @param batchUpdateDataTypesInputBody (required) - * @return ApiResponse<BatchUpdateDataTypesOutputBody> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public ApiResponse batchUpdateFunctionDataTypesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull BatchUpdateDataTypesInputBody batchUpdateDataTypesInputBody) throws ApiException { - okhttp3.Call localVarCall = batchUpdateFunctionDataTypesValidateBeforeCall(analysisId, batchUpdateDataTypesInputBody, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Batch update function data types (asynchronously) - * Updates data types for multiple functions in one analysis. All function IDs in the body must belong to the analysis. Each item is processed independently and reports its own outcome: a stale `data_types_version` yields `version_conflict` for that item without affecting the rest of the batch. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param analysisId Analysis ID (required) - * @param batchUpdateDataTypesInputBody (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call batchUpdateFunctionDataTypesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull BatchUpdateDataTypesInputBody batchUpdateDataTypesInputBody, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = batchUpdateFunctionDataTypesValidateBeforeCall(analysisId, batchUpdateDataTypesInputBody, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for generateFunctionDataTypesForAnalysis - * @param analysisId (required) - * @param functionDataTypesParams (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
201 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call generateFunctionDataTypesForAnalysisCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams, 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 = functionDataTypesParams; - - // create path and map variables - String localVarPath = "/v2/analyses/{analysis_id}/functions/data_types" - .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "APIKey", "bearerAuth" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call generateFunctionDataTypesForAnalysisValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams, 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 generateFunctionDataTypesForAnalysis(Async)"); - } - - // verify the required parameter 'functionDataTypesParams' is set - if (functionDataTypesParams == null) { - throw new ApiException("Missing the required parameter 'functionDataTypesParams' when calling generateFunctionDataTypesForAnalysis(Async)"); - } - - return generateFunctionDataTypesForAnalysisCall(analysisId, functionDataTypesParams, _callback); - - } - - /** - * Generate Function Data Types - * Submits a request to generate the function data types - * @param analysisId (required) - * @param functionDataTypesParams (required) - * @return BaseResponseGenerateFunctionDataTypes - * @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 Successful Response -
422 Invalid request parameters -
- */ - public BaseResponseGenerateFunctionDataTypes generateFunctionDataTypesForAnalysis(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams) throws ApiException { - ApiResponse localVarResp = generateFunctionDataTypesForAnalysisWithHttpInfo(analysisId, functionDataTypesParams); - return localVarResp.getData(); - } - - /** - * Generate Function Data Types - * Submits a request to generate the function data types - * @param analysisId (required) - * @param functionDataTypesParams (required) - * @return ApiResponse<BaseResponseGenerateFunctionDataTypes> - * @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 Successful Response -
422 Invalid request parameters -
- */ - public ApiResponse generateFunctionDataTypesForAnalysisWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams) throws ApiException { - okhttp3.Call localVarCall = generateFunctionDataTypesForAnalysisValidateBeforeCall(analysisId, functionDataTypesParams, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Generate Function Data Types (asynchronously) - * Submits a request to generate the function data types - * @param analysisId (required) - * @param functionDataTypesParams (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
201 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call generateFunctionDataTypesForAnalysisAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = generateFunctionDataTypesForAnalysisValidateBeforeCall(analysisId, functionDataTypesParams, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for generateFunctionDataTypesForFunctions - * @param functionDataTypesParams (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
201 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call generateFunctionDataTypesForFunctionsCall(@javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams, 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 = functionDataTypesParams; - - // create path and map variables - String localVarPath = "/v2/functions/data_types"; - - 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 generateFunctionDataTypesForFunctionsValidateBeforeCall(@javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'functionDataTypesParams' is set - if (functionDataTypesParams == null) { - throw new ApiException("Missing the required parameter 'functionDataTypesParams' when calling generateFunctionDataTypesForFunctions(Async)"); - } - - return generateFunctionDataTypesForFunctionsCall(functionDataTypesParams, _callback); - - } - - /** - * Generate Function Data Types for an arbitrary list of functions - * Submits a request to generate the function data types - * @param functionDataTypesParams (required) - * @return BaseResponseGenerationStatusList - * @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 Successful Response -
422 Invalid request parameters -
- */ - public BaseResponseGenerationStatusList generateFunctionDataTypesForFunctions(@javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams) throws ApiException { - ApiResponse localVarResp = generateFunctionDataTypesForFunctionsWithHttpInfo(functionDataTypesParams); - return localVarResp.getData(); - } - - /** - * Generate Function Data Types for an arbitrary list of functions - * Submits a request to generate the function data types - * @param functionDataTypesParams (required) - * @return ApiResponse<BaseResponseGenerationStatusList> - * @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 Successful Response -
422 Invalid request parameters -
- */ - public ApiResponse generateFunctionDataTypesForFunctionsWithHttpInfo(@javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams) throws ApiException { - okhttp3.Call localVarCall = generateFunctionDataTypesForFunctionsValidateBeforeCall(functionDataTypesParams, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Generate Function Data Types for an arbitrary list of functions (asynchronously) - * Submits a request to generate the function data types - * @param functionDataTypesParams (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
201 Successful Response -
422 Invalid request parameters -
- */ - public okhttp3.Call generateFunctionDataTypesForFunctionsAsync(@javax.annotation.Nonnull FunctionDataTypesParams functionDataTypesParams, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = generateFunctionDataTypesForFunctionsValidateBeforeCall(functionDataTypesParams, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for getFunctionDataTypes - * @param analysisId Analysis ID (required) - * @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 getFunctionDataTypesCall(@javax.annotation.Nonnull Long analysisId, @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/analyses/{analysis_id}/functions/{function_id}/data-types" - .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) - .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 getFunctionDataTypesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, 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 getFunctionDataTypes(Async)"); - } - - // verify the required parameter 'functionId' is set - if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling getFunctionDataTypes(Async)"); - } - - return getFunctionDataTypesCall(analysisId, functionId, _callback); - - } - - /** - * Get data types for a single function - * Returns the stored data-types blob for one function. The function must belong to the supplied analysis. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - * @param analysisId Analysis ID (required) - * @param functionId Function ID (required) - * @return DataTypesEntry - * @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 DataTypesEntry getFunctionDataTypes(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId) throws ApiException { - ApiResponse localVarResp = getFunctionDataTypesWithHttpInfo(analysisId, functionId); - return localVarResp.getData(); - } - - /** - * Get data types for a single function - * Returns the stored data-types blob for one function. The function must belong to the supplied analysis. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - * @param analysisId Analysis ID (required) - * @param functionId Function ID (required) - * @return ApiResponse<DataTypesEntry> - * @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 getFunctionDataTypesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId) throws ApiException { - okhttp3.Call localVarCall = getFunctionDataTypesValidateBeforeCall(analysisId, functionId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get data types for a single function (asynchronously) - * Returns the stored data-types blob for one function. The function must belong to the supplied analysis. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - * @param analysisId Analysis ID (required) - * @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 getFunctionDataTypesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getFunctionDataTypesValidateBeforeCall(analysisId, functionId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for listAnalysisFunctionsDataTypes - * @param analysisId Analysis ID (required) - * @param offset Pagination offset. Defaults to 0. (optional) - * @param limit Page size. Defaults to 100. (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
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call listAnalysisFunctionsDataTypesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, 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}/functions/data-types" - .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(); - - if (offset != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); - } - - if (limit != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); - } - - 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 listAnalysisFunctionsDataTypesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, 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 listAnalysisFunctionsDataTypes(Async)"); - } - - return listAnalysisFunctionsDataTypesCall(analysisId, offset, limit, _callback); - - } - - /** - * List data types for all functions in an analysis - * Paginated read of the stored data-types blob for each function in the analysis. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - * @param analysisId Analysis ID (required) - * @param offset Pagination offset. Defaults to 0. (optional) - * @param limit Page size. Defaults to 100. (optional) - * @return ListAnalysisFunctionsDataTypesOutputBody - * @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 ListAnalysisFunctionsDataTypesOutputBody listAnalysisFunctionsDataTypes(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit) throws ApiException { - ApiResponse localVarResp = listAnalysisFunctionsDataTypesWithHttpInfo(analysisId, offset, limit); - return localVarResp.getData(); - } - - /** - * List data types for all functions in an analysis - * Paginated read of the stored data-types blob for each function in the analysis. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - * @param analysisId Analysis ID (required) - * @param offset Pagination offset. Defaults to 0. (optional) - * @param limit Page size. Defaults to 100. (optional) - * @return ApiResponse<ListAnalysisFunctionsDataTypesOutputBody> - * @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 listAnalysisFunctionsDataTypesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit) throws ApiException { - okhttp3.Call localVarCall = listAnalysisFunctionsDataTypesValidateBeforeCall(analysisId, offset, limit, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * List data types for all functions in an analysis (asynchronously) - * Paginated read of the stored data-types blob for each function in the analysis. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - * @param analysisId Analysis ID (required) - * @param offset Pagination offset. Defaults to 0. (optional) - * @param limit Page size. Defaults to 100. (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
200 OK -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call listAnalysisFunctionsDataTypesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nullable Long offset, @javax.annotation.Nullable Long limit, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listAnalysisFunctionsDataTypesValidateBeforeCall(analysisId, offset, limit, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for listFunctionDataTypesForAnalysis - * @param analysisId (required) - * @param functionIds (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
200 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public okhttp3.Call listFunctionDataTypesForAnalysisCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable List functionIds, 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 = "/v2/analyses/{analysis_id}/functions/data_types" - .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(); - - if (functionIds != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "function_ids", functionIds)); - } - - 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); - } - - @Deprecated - @SuppressWarnings("rawtypes") - private okhttp3.Call listFunctionDataTypesForAnalysisValidateBeforeCall(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable List functionIds, 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 listFunctionDataTypesForAnalysis(Async)"); - } - - return listFunctionDataTypesForAnalysisCall(analysisId, functionIds, _callback); - - } - - /** - * List Function Data Types - * Returns data types for multiple functions with optional function ID filtering - * @param analysisId (required) - * @param functionIds (optional) - * @return BaseResponseFunctionDataTypesList - * @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 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public BaseResponseFunctionDataTypesList listFunctionDataTypesForAnalysis(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable List functionIds) throws ApiException { - ApiResponse localVarResp = listFunctionDataTypesForAnalysisWithHttpInfo(analysisId, functionIds); - return localVarResp.getData(); - } - - /** - * List Function Data Types - * Returns data types for multiple functions with optional function ID filtering - * @param analysisId (required) - * @param functionIds (optional) - * @return ApiResponse<BaseResponseFunctionDataTypesList> - * @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 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public ApiResponse listFunctionDataTypesForAnalysisWithHttpInfo(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable List functionIds) throws ApiException { - okhttp3.Call localVarCall = listFunctionDataTypesForAnalysisValidateBeforeCall(analysisId, functionIds, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * List Function Data Types (asynchronously) - * Returns data types for multiple functions with optional function ID filtering - * @param analysisId (required) - * @param functionIds (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
200 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public okhttp3.Call listFunctionDataTypesForAnalysisAsync(@javax.annotation.Nonnull Integer analysisId, @javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listFunctionDataTypesForAnalysisValidateBeforeCall(analysisId, functionIds, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for listFunctionDataTypesForFunctions - * @param functionIds (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
200 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public okhttp3.Call listFunctionDataTypesForFunctionsCall(@javax.annotation.Nullable List functionIds, 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 = "/v2/functions/data_types"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (functionIds != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("multi", "function_ids", functionIds)); - } - - 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); - } - - @Deprecated - @SuppressWarnings("rawtypes") - private okhttp3.Call listFunctionDataTypesForFunctionsValidateBeforeCall(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - return listFunctionDataTypesForFunctionsCall(functionIds, _callback); - - } - - /** - * List Function Data Types - * Returns data types for multiple function IDs - * @param functionIds (optional) - * @return BaseResponseFunctionDataTypesList - * @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 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public BaseResponseFunctionDataTypesList listFunctionDataTypesForFunctions(@javax.annotation.Nullable List functionIds) throws ApiException { - ApiResponse localVarResp = listFunctionDataTypesForFunctionsWithHttpInfo(functionIds); - return localVarResp.getData(); - } - - /** - * List Function Data Types - * Returns data types for multiple function IDs - * @param functionIds (optional) - * @return ApiResponse<BaseResponseFunctionDataTypesList> - * @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 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public ApiResponse listFunctionDataTypesForFunctionsWithHttpInfo(@javax.annotation.Nullable List functionIds) throws ApiException { - okhttp3.Call localVarCall = listFunctionDataTypesForFunctionsValidateBeforeCall(functionIds, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * List Function Data Types (asynchronously) - * Returns data types for multiple function IDs - * @param functionIds (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
200 Successful Response -
422 Invalid request parameters -
- * @deprecated - */ - @Deprecated - public okhttp3.Call listFunctionDataTypesForFunctionsAsync(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listFunctionDataTypesForFunctionsValidateBeforeCall(functionIds, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for listFunctionsDataTypes - * @param functionIds Function IDs to fetch data-types for. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call listFunctionsDataTypesCall(@javax.annotation.Nullable List functionIds, 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/data-types"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (functionIds != null) { - localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("csv", "function_ids", functionIds)); - } - - 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 listFunctionsDataTypesValidateBeforeCall(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'functionIds' is set - if (functionIds == null) { - throw new ApiException("Missing the required parameter 'functionIds' when calling listFunctionsDataTypes(Async)"); - } - - return listFunctionsDataTypesCall(functionIds, _callback); - - } - - /** - * Get data types for many functions - * Returns the stored data-types blob for each supplied function ID. Caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Function IDs to fetch data-types for. (required) - * @return ListFunctionsDataTypesOutputBody - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public ListFunctionsDataTypesOutputBody listFunctionsDataTypes(@javax.annotation.Nullable List functionIds) throws ApiException { - ApiResponse localVarResp = listFunctionsDataTypesWithHttpInfo(functionIds); - return localVarResp.getData(); - } - - /** - * Get data types for many functions - * Returns the stored data-types blob for each supplied function ID. Caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Function IDs to fetch data-types for. (required) - * @return ApiResponse<ListFunctionsDataTypesOutputBody> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public ApiResponse listFunctionsDataTypesWithHttpInfo(@javax.annotation.Nullable List functionIds) throws ApiException { - okhttp3.Call localVarCall = listFunctionsDataTypesValidateBeforeCall(functionIds, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get data types for many functions (asynchronously) - * Returns the stored data-types blob for each supplied function ID. Caller must have read access to every function or the request is rejected. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - * @param functionIds Function IDs to fetch data-types for. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call listFunctionsDataTypesAsync(@javax.annotation.Nullable List functionIds, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = listFunctionsDataTypesValidateBeforeCall(functionIds, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for updateFunctionDataTypes - * @param analysisId Analysis ID (required) - * @param functionId Function ID (required) - * @param updateDataTypesInputBody (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call updateFunctionDataTypesCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateDataTypesInputBody updateDataTypesInputBody, 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 = updateDataTypesInputBody; - - // create path and map variables - String localVarPath = "/v2/analyses/{analysis_id}/functions/{function_id}/data_types" - .replace("{" + "analysis_id" + "}", localVarApiClient.escapeString(analysisId.toString())) - .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, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call updateFunctionDataTypesValidateBeforeCall(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateDataTypesInputBody updateDataTypesInputBody, 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 updateFunctionDataTypes(Async)"); - } - - // verify the required parameter 'functionId' is set - if (functionId == null) { - throw new ApiException("Missing the required parameter 'functionId' when calling updateFunctionDataTypes(Async)"); - } - - // verify the required parameter 'updateDataTypesInputBody' is set - if (updateDataTypesInputBody == null) { - throw new ApiException("Missing the required parameter 'updateDataTypesInputBody' when calling updateFunctionDataTypes(Async)"); - } - - return updateFunctionDataTypesCall(analysisId, functionId, updateDataTypesInputBody, _callback); - - } - - /** - * Update function data types - * Stores user-specific overrides for a function's data types. Uses optimistic concurrency: if the stored version doesn't match `data_types_version`, the update is rejected with 409. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - * @param analysisId Analysis ID (required) - * @param functionId Function ID (required) - * @param updateDataTypesInputBody (required) - * @return UpdateDataTypesOutputBody - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public UpdateDataTypesOutputBody updateFunctionDataTypes(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateDataTypesInputBody updateDataTypesInputBody) throws ApiException { - ApiResponse localVarResp = updateFunctionDataTypesWithHttpInfo(analysisId, functionId, updateDataTypesInputBody); - return localVarResp.getData(); - } - - /** - * Update function data types - * Stores user-specific overrides for a function's data types. Uses optimistic concurrency: if the stored version doesn't match `data_types_version`, the update is rejected with 409. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - * @param analysisId Analysis ID (required) - * @param functionId Function ID (required) - * @param updateDataTypesInputBody (required) - * @return ApiResponse<UpdateDataTypesOutputBody> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public ApiResponse updateFunctionDataTypesWithHttpInfo(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateDataTypesInputBody updateDataTypesInputBody) throws ApiException { - okhttp3.Call localVarCall = updateFunctionDataTypesValidateBeforeCall(analysisId, functionId, updateDataTypesInputBody, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Update function data types (asynchronously) - * Stores user-specific overrides for a function's data types. Uses optimistic concurrency: if the stored version doesn't match `data_types_version`, the update is rejected with 409. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict - * @param analysisId Analysis ID (required) - * @param functionId Function ID (required) - * @param updateDataTypesInputBody (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - - - - -
Response Details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
422 Unprocessable Entity -
500 Internal Server Error -
- */ - public okhttp3.Call updateFunctionDataTypesAsync(@javax.annotation.Nonnull Long analysisId, @javax.annotation.Nonnull Long functionId, @javax.annotation.Nonnull UpdateDataTypesInputBody updateDataTypesInputBody, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateFunctionDataTypesValidateBeforeCall(analysisId, functionId, updateDataTypesInputBody, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/src/main/java/ai/reveng/api/FunctionsRenamingHistoryApi.java b/src/main/java/ai/reveng/api/FunctionsRenamingHistoryApi.java index e91c7cbd..61a5cff7 100644 --- a/src/main/java/ai/reveng/api/FunctionsRenamingHistoryApi.java +++ b/src/main/java/ai/reveng/api/FunctionsRenamingHistoryApi.java @@ -295,7 +295,7 @@ private okhttp3.Call batchRenameFunctionsValidateBeforeCall(@javax.annotation.No /** * Batch rename functions - * Renames multiple functions in a single request. Records name changes in history and copies data types from source functions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + * Renames multiple functions in a single request. Records name changes in history. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param batchRenameInputBody (required) * @return BatchRenameOutputBody * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -317,7 +317,7 @@ public BatchRenameOutputBody batchRenameFunctions(@javax.annotation.Nonnull Batc /** * Batch rename functions - * Renames multiple functions in a single request. Records name changes in history and copies data types from source functions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + * Renames multiple functions in a single request. Records name changes in history. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param batchRenameInputBody (required) * @return ApiResponse<BatchRenameOutputBody> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -340,7 +340,7 @@ public ApiResponse batchRenameFunctionsWithHttpInfo(@java /** * Batch rename functions (asynchronously) - * Renames multiple functions in a single request. Records name changes in history and copies data types from source functions. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request + * Renames multiple functions in a single request. Records name changes in history. **Error codes:** - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `400` [`BAD_REQUEST`](/errors/BAD_REQUEST) — Bad Request * @param batchRenameInputBody (required) * @param _callback The callback to be executed when the API call finishes * @return The request call diff --git a/src/main/java/ai/reveng/invoker/ApiClient.java b/src/main/java/ai/reveng/invoker/ApiClient.java index 181f221b..c3069cef 100644 --- a/src/main/java/ai/reveng/invoker/ApiClient.java +++ b/src/main/java/ai/reveng/invoker/ApiClient.java @@ -148,7 +148,7 @@ protected void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/3.131.1/java"); + setUserAgent("OpenAPI-Generator/4.4.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 1f50b5c2..f5dcf070 100644 --- a/src/main/java/ai/reveng/invoker/Configuration.java +++ b/src/main/java/ai/reveng/invoker/Configuration.java @@ -18,7 +18,7 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class Configuration { - public static final String VERSION = "3.131.1"; + public static final String VERSION = "4.4.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 3e161fd9..5ef87078 100644 --- a/src/main/java/ai/reveng/invoker/JSON.java +++ b/src/main/java/ai/reveng/invoker/JSON.java @@ -63,6 +63,63 @@ public class JSON { @SuppressWarnings("unchecked") public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(ai.reveng.model.CreateDataTypeEntry.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ARRAY", ai.reveng.model.CreateArrayDataType.class); + classByDiscriminatorValue.put("BASE", ai.reveng.model.CreateBaseDataType.class); + classByDiscriminatorValue.put("BITFIELD", ai.reveng.model.CreateBitfieldDataType.class); + classByDiscriminatorValue.put("ENUM", ai.reveng.model.CreateEnumDataType.class); + classByDiscriminatorValue.put("FUNCTION_DEFINITION", ai.reveng.model.CreateFunctionDataType.class); + classByDiscriminatorValue.put("POINTER", ai.reveng.model.CreatePointerDataType.class); + classByDiscriminatorValue.put("STRUCT", ai.reveng.model.CreateStructDataType.class); + classByDiscriminatorValue.put("TYPEDEF", ai.reveng.model.CreateTypedefDataType.class); + classByDiscriminatorValue.put("UNION", ai.reveng.model.CreateUnionDataType.class); + classByDiscriminatorValue.put("UNKNOWN", ai.reveng.model.CreateUnknownDataType.class); + classByDiscriminatorValue.put("CreateDataTypeEntry", ai.reveng.model.CreateDataTypeEntry.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "kind")); + } + }) + .registerTypeSelector(ai.reveng.model.DataTypeEntry.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ARRAY", ai.reveng.model.ArrayDataType.class); + classByDiscriminatorValue.put("BASE", ai.reveng.model.BaseDataType.class); + classByDiscriminatorValue.put("BITFIELD", ai.reveng.model.BitfieldDataType.class); + classByDiscriminatorValue.put("ENUM", ai.reveng.model.EnumDataType.class); + classByDiscriminatorValue.put("FUNCTION_DEFINITION", ai.reveng.model.FunctionDataType.class); + classByDiscriminatorValue.put("POINTER", ai.reveng.model.PointerDataType.class); + classByDiscriminatorValue.put("STRUCT", ai.reveng.model.StructDataType.class); + classByDiscriminatorValue.put("TYPEDEF", ai.reveng.model.TypedefDataType.class); + classByDiscriminatorValue.put("UNION", ai.reveng.model.UnionDataType.class); + classByDiscriminatorValue.put("UNKNOWN", ai.reveng.model.UnknownDataType.class); + classByDiscriminatorValue.put("DataTypeEntry", ai.reveng.model.DataTypeEntry.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "kind")); + } + }) + .registerTypeSelector(ai.reveng.model.UpdateDataTypeEntry.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("ARRAY", ai.reveng.model.UpdateArrayDataType.class); + classByDiscriminatorValue.put("BASE", ai.reveng.model.UpdateBaseDataType.class); + classByDiscriminatorValue.put("BITFIELD", ai.reveng.model.UpdateBitfieldDataType.class); + classByDiscriminatorValue.put("ENUM", ai.reveng.model.UpdateEnumDataType.class); + classByDiscriminatorValue.put("FUNCTION_DEFINITION", ai.reveng.model.UpdateFunctionDataType.class); + classByDiscriminatorValue.put("POINTER", ai.reveng.model.UpdatePointerDataType.class); + classByDiscriminatorValue.put("STRUCT", ai.reveng.model.UpdateStructDataType.class); + classByDiscriminatorValue.put("TYPEDEF", ai.reveng.model.UpdateTypedefDataType.class); + classByDiscriminatorValue.put("UNION", ai.reveng.model.UpdateUnionDataType.class); + classByDiscriminatorValue.put("UNKNOWN", ai.reveng.model.UpdateUnknownDataType.class); + classByDiscriminatorValue.put("UpdateDataTypeEntry", ai.reveng.model.UpdateDataTypeEntry.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "kind")); + } + }) ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; @@ -98,9 +155,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AIDecompFunctionMapping.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AIDecompInverseFunctionMapItem.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AIDecompInverseStringMapItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.APIError.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddCalleeInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AddCollectionBinariesInputBody.CustomTypeAdapterFactory()); @@ -119,11 +173,14 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisConfigSnapshot.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisCreateRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisCreateResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisDataTypesGroup.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisDataTypesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisDetailResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionMapping.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisFunctionsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisLogEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisLogMessage.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisLogs.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AnalysisRecord.CustomTypeAdapterFactory()); @@ -145,12 +202,14 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2FunctionsTypesFunction.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AppApiRestV2InfoTypesCapability.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ArchiveContentEntry.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Argument.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ArrayDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ArrayDefinition.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Artifact.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AttemptFailedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AttemptStartedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoRunAgents.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.AutoUnstripStatusOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAdditionalDetailsStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseAnalysisBulkAddTagsResponse.CustomTypeAdapterFactory()); @@ -185,13 +244,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseExternalResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseFunctionBlocksResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseFunctionCapabilityResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseFunctionDataTypes.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseFunctionDataTypesList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseFunctionSearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseFunctionStringsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseFunctionsDetailResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseGenerateFunctionDataTypes.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseGenerationStatusList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseGetPublicUserResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListCalleesCallerFunctionsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseListCollectionResults.CustomTypeAdapterFactory()); @@ -217,14 +272,11 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BaseResponseXrefResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Basic.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchBinaryMatchResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchFunctionSignatureEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchMatchingOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchRenameInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchRenameItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchRenameOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchUpdateDataTypesInputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchUpdateDataTypesItem.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchUpdateDataTypesOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BatchUpdateDataTypesResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinariesRelatedStatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Binary.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryAdditionalDetailsDataResponse.CustomTypeAdapterFactory()); @@ -234,6 +286,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinaryExternalsResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinarySearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BinarySearchResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BitfieldDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkCreateUserResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkCreateUsersOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.BulkDeleteAnalysesRequest.CustomTypeAdapterFactory()); @@ -276,20 +329,40 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Conversation.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ConversationContext.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ConversationWithEvents.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CopyFunctionSignaturesInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CopyFunctionSignaturesOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CopySignatureItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateAIDecompOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateAnalysisDataTypesInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateArrayDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateBaseDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateBitfieldDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateCheckoutSessionInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateCollectionInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateCollectionOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateConversationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateDataTypeEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateEnumDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateFunctionDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateGroupInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateIdentityInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateIssuerInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateOrganisationInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreatePointerDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreatePortalSessionInputBody.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()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateUnionDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateUnknownDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.CreateUserInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Created.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypesEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeEnumValueEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeFunctionEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeFunctionParameterEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeMemberEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DataTypeVersion.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompFailedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompFinishedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.DecompilationCommentContext.CustomTypeAdapterFactory()); @@ -308,7 +381,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ELFSymbol.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ElfDynamicEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EntrypointModel.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Enumeration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EnumDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.EnumDefinition.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ErrorBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ErrorModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Event.CustomTypeAdapterFactory()); @@ -346,23 +420,14 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileHashes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FileMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FormFile.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FuncDepsInner.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionArgument.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionBlockDestinationResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionBlockResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionBlocksResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionBoundary.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionCallEdges.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionCapabilityResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDataTypes.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDataTypesList.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDataTypesListItem.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDataTypesParams.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDataTypesStatus.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDependency.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionDetailsOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionHeader.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionListItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionLocalVariableResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionMapping.CustomTypeAdapterFactory()); @@ -373,27 +438,31 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionRenameMap.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSearchResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSearchResult.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionStackVariable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSignatureBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSignatureEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionSignatureVersion.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionString.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionStringItem.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionStringsResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionTypeDefinition.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionsDetailResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.FunctionsListRename.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GenerateFunctionDataTypes.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GeneratePDFOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GenerationStatusList.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()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAnalysisLogsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetAnalysisStringsStatusOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetCollectionOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetDataTypeHistoryBody.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.GetProductsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetPublicUserResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetSubscriptionOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GlobalVariable.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.GetTokensResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.HistoryActor.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.HistoryEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.HttpRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IOC.CustomTypeAdapterFactory()); @@ -408,16 +477,18 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InsertAnalysisLogRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.InviteUserInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.IssuerAllowedDomain.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.LineAttributionsData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysesOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisFunctionsDataTypesOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisDataTypesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisFunctionsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListAnalysisStringsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListArchiveContentsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListCollectionResults.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListCollectionsOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListDataTypeFunctionsBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListExampleAnalysesOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionSignaturesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionStringsOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListFunctionsDataTypesOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListImportedFunctionsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListTeamsOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ListUsersOutputBody.CustomTypeAdapterFactory()); @@ -454,6 +525,8 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PatchCommentBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PcapBodyInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Permissions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PointerDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PointerDefinition.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PriceOutput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.PriceSummary.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ProcessActivityEntry.CustomTypeAdapterFactory()); @@ -478,11 +551,13 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameAppliedEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameOutputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReplacementValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenameUnnamedFunctionsResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RenderedToken.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportAnalysisResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportInfo.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ReportOptions.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ResolvedEntity.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.RevokeBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SSOProvider.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SSOProvidersOutputBody.CustomTypeAdapterFactory()); @@ -497,6 +572,10 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ServerSentEventsInner1.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.ServiceEntry.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SessionOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SignatureParameterEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SignatureParameterInput.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SignatureStorageEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SignatureStorageInput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SingleCodeCertificateModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SingleCodeSignatureModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SinglePDBEntryModel.CustomTypeAdapterFactory()); @@ -520,17 +599,17 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventToolCallResultData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventToolCallStartData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SseEventToolConfirmationRequiredData.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StackVariable.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartBatchMatchingInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartMatchingForAnalysisInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartMatchingForFunctionsInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartMatchingOutputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StartupInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusOutput.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StatusResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StringFunctions.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Structure.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StructureMember.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StructDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.StructDefinition.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SubmitUserFeedbackRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.SummaryData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Symbols.CustomTypeAdapterFactory()); @@ -545,21 +624,38 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Team.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TeamMember.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TimestampModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Token.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TokenInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TokenResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TokenisedData.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriageFunctionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriageReportResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriggerDynamicExecutionInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TriggerRenameUnnamedFunctionsInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.Ttp.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypeDefinition.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateDataTypesInputBody.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateDataTypesOutputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypedefDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.TypedefDefinition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UnionDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UnionDefinition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UnknownDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateAnalysisDataTypesInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateArrayDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateBaseDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateBitfieldDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateDataTypeEntry.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateEnumDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateFunctionDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateFunctionSignatureInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateIssuerInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateOrganisationInputBody.CustomTypeAdapterFactory()); 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.UpdateStructDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateTeamInputBody.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateTypedefDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateUnionDataType.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateUnknownDataType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateUserCreditsInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateUserInputBody.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.UpdateUserPasswordInputBody.CustomTypeAdapterFactory()); @@ -572,9 +668,6 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri 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.V2FunctionHeader.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.V2FunctionInfo.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.V2FunctionType.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WarningEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.WorkflowProgress.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new ai.reveng.model.XrefFromResponse.CustomTypeAdapterFactory()); diff --git a/src/main/java/ai/reveng/model/AIDecompFunctionMapping.java b/src/main/java/ai/reveng/model/AIDecompFunctionMapping.java deleted file mode 100644 index b00e39ab..00000000 --- a/src/main/java/ai/reveng/model/AIDecompFunctionMapping.java +++ /dev/null @@ -1,660 +0,0 @@ -/* - * 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.AIDecompInverseFunctionMapItem; -import ai.reveng.model.AIDecompInverseStringMapItem; -import ai.reveng.model.ReplacementValue; -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; - -/** - * AIDecompFunctionMapping - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AIDecompFunctionMapping { - public static final String SERIALIZED_NAME_FIELDS = "fields"; - @SerializedName(SERIALIZED_NAME_FIELDS) - @javax.annotation.Nonnull - private Map> fields = 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_INVERSE_STRING_MAP = "inverse_string_map"; - @SerializedName(SERIALIZED_NAME_INVERSE_STRING_MAP) - @javax.annotation.Nonnull - private Map inverseStringMap = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_CUSTOM_FUNCTION_POINTERS = "unmatched_custom_function_pointers"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_CUSTOM_FUNCTION_POINTERS) - @javax.annotation.Nonnull - private Map unmatchedCustomFunctionPointers = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_CUSTOM_TYPES = "unmatched_custom_types"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_CUSTOM_TYPES) - @javax.annotation.Nonnull - private Map unmatchedCustomTypes = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_ENUMS = "unmatched_enums"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_ENUMS) - @javax.annotation.Nonnull - private Map unmatchedEnums = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_EXTERNAL_VARS = "unmatched_external_vars"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_EXTERNAL_VARS) - @javax.annotation.Nonnull - private Map unmatchedExternalVars = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_FUNCTIONS = "unmatched_functions"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_FUNCTIONS) - @javax.annotation.Nonnull - private Map unmatchedFunctions = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_GLOBAL_VARS = "unmatched_global_vars"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_GLOBAL_VARS) - @javax.annotation.Nonnull - private Map unmatchedGlobalVars = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_GO_TO_LABELS = "unmatched_go_to_labels"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_GO_TO_LABELS) - @javax.annotation.Nonnull - private Map unmatchedGoToLabels = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_STRINGS = "unmatched_strings"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_STRINGS) - @javax.annotation.Nonnull - private Map unmatchedStrings = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_VARIADIC_LISTS = "unmatched_variadic_lists"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_VARIADIC_LISTS) - @javax.annotation.Nonnull - private Map unmatchedVariadicLists = new HashMap<>(); - - public static final String SERIALIZED_NAME_UNMATCHED_VARS = "unmatched_vars"; - @SerializedName(SERIALIZED_NAME_UNMATCHED_VARS) - @javax.annotation.Nonnull - private Map unmatchedVars = new HashMap<>(); - - public static final String SERIALIZED_NAME_USER_OVERRIDE_MAPPINGS = "user_override_mappings"; - @SerializedName(SERIALIZED_NAME_USER_OVERRIDE_MAPPINGS) - @javax.annotation.Nonnull - private Map userOverrideMappings = new HashMap<>(); - - public AIDecompFunctionMapping() { - } - - public AIDecompFunctionMapping fields(@javax.annotation.Nonnull Map> fields) { - this.fields = fields; - return this; - } - - public AIDecompFunctionMapping putFieldsItem(String key, Map fieldsItem) { - if (this.fields == null) { - this.fields = new HashMap<>(); - } - this.fields.put(key, fieldsItem); - return this; - } - - /** - * Get fields - * @return fields - */ - @javax.annotation.Nonnull - public Map> getFields() { - return fields; - } - - public void setFields(@javax.annotation.Nonnull Map> fields) { - this.fields = fields; - } - - - public AIDecompFunctionMapping inverseFunctionMap(@javax.annotation.Nonnull Map inverseFunctionMap) { - this.inverseFunctionMap = inverseFunctionMap; - return this; - } - - public AIDecompFunctionMapping putInverseFunctionMapItem(String key, AIDecompInverseFunctionMapItem inverseFunctionMapItem) { - if (this.inverseFunctionMap == null) { - this.inverseFunctionMap = new HashMap<>(); - } - this.inverseFunctionMap.put(key, inverseFunctionMapItem); - return this; - } - - /** - * Get inverseFunctionMap - * @return inverseFunctionMap - */ - @javax.annotation.Nonnull - public Map getInverseFunctionMap() { - return inverseFunctionMap; - } - - public void setInverseFunctionMap(@javax.annotation.Nonnull Map inverseFunctionMap) { - this.inverseFunctionMap = inverseFunctionMap; - } - - - public AIDecompFunctionMapping inverseStringMap(@javax.annotation.Nonnull Map inverseStringMap) { - this.inverseStringMap = inverseStringMap; - return this; - } - - public AIDecompFunctionMapping putInverseStringMapItem(String key, AIDecompInverseStringMapItem inverseStringMapItem) { - if (this.inverseStringMap == null) { - this.inverseStringMap = new HashMap<>(); - } - this.inverseStringMap.put(key, inverseStringMapItem); - return this; - } - - /** - * Get inverseStringMap - * @return inverseStringMap - */ - @javax.annotation.Nonnull - public Map getInverseStringMap() { - return inverseStringMap; - } - - public void setInverseStringMap(@javax.annotation.Nonnull Map inverseStringMap) { - this.inverseStringMap = inverseStringMap; - } - - - public AIDecompFunctionMapping unmatchedCustomFunctionPointers(@javax.annotation.Nonnull Map unmatchedCustomFunctionPointers) { - this.unmatchedCustomFunctionPointers = unmatchedCustomFunctionPointers; - return this; - } - - public AIDecompFunctionMapping putUnmatchedCustomFunctionPointersItem(String key, ReplacementValue unmatchedCustomFunctionPointersItem) { - if (this.unmatchedCustomFunctionPointers == null) { - this.unmatchedCustomFunctionPointers = new HashMap<>(); - } - this.unmatchedCustomFunctionPointers.put(key, unmatchedCustomFunctionPointersItem); - return this; - } - - /** - * Get unmatchedCustomFunctionPointers - * @return unmatchedCustomFunctionPointers - */ - @javax.annotation.Nonnull - public Map getUnmatchedCustomFunctionPointers() { - return unmatchedCustomFunctionPointers; - } - - public void setUnmatchedCustomFunctionPointers(@javax.annotation.Nonnull Map unmatchedCustomFunctionPointers) { - this.unmatchedCustomFunctionPointers = unmatchedCustomFunctionPointers; - } - - - public AIDecompFunctionMapping unmatchedCustomTypes(@javax.annotation.Nonnull Map unmatchedCustomTypes) { - this.unmatchedCustomTypes = unmatchedCustomTypes; - return this; - } - - public AIDecompFunctionMapping putUnmatchedCustomTypesItem(String key, ReplacementValue unmatchedCustomTypesItem) { - if (this.unmatchedCustomTypes == null) { - this.unmatchedCustomTypes = new HashMap<>(); - } - this.unmatchedCustomTypes.put(key, unmatchedCustomTypesItem); - return this; - } - - /** - * Get unmatchedCustomTypes - * @return unmatchedCustomTypes - */ - @javax.annotation.Nonnull - public Map getUnmatchedCustomTypes() { - return unmatchedCustomTypes; - } - - public void setUnmatchedCustomTypes(@javax.annotation.Nonnull Map unmatchedCustomTypes) { - this.unmatchedCustomTypes = unmatchedCustomTypes; - } - - - public AIDecompFunctionMapping unmatchedEnums(@javax.annotation.Nonnull Map unmatchedEnums) { - this.unmatchedEnums = unmatchedEnums; - return this; - } - - public AIDecompFunctionMapping putUnmatchedEnumsItem(String key, ReplacementValue unmatchedEnumsItem) { - if (this.unmatchedEnums == null) { - this.unmatchedEnums = new HashMap<>(); - } - this.unmatchedEnums.put(key, unmatchedEnumsItem); - return this; - } - - /** - * Get unmatchedEnums - * @return unmatchedEnums - */ - @javax.annotation.Nonnull - public Map getUnmatchedEnums() { - return unmatchedEnums; - } - - public void setUnmatchedEnums(@javax.annotation.Nonnull Map unmatchedEnums) { - this.unmatchedEnums = unmatchedEnums; - } - - - public AIDecompFunctionMapping unmatchedExternalVars(@javax.annotation.Nonnull Map unmatchedExternalVars) { - this.unmatchedExternalVars = unmatchedExternalVars; - return this; - } - - public AIDecompFunctionMapping putUnmatchedExternalVarsItem(String key, ReplacementValue unmatchedExternalVarsItem) { - if (this.unmatchedExternalVars == null) { - this.unmatchedExternalVars = new HashMap<>(); - } - this.unmatchedExternalVars.put(key, unmatchedExternalVarsItem); - return this; - } - - /** - * Get unmatchedExternalVars - * @return unmatchedExternalVars - */ - @javax.annotation.Nonnull - public Map getUnmatchedExternalVars() { - return unmatchedExternalVars; - } - - public void setUnmatchedExternalVars(@javax.annotation.Nonnull Map unmatchedExternalVars) { - this.unmatchedExternalVars = unmatchedExternalVars; - } - - - public AIDecompFunctionMapping unmatchedFunctions(@javax.annotation.Nonnull Map unmatchedFunctions) { - this.unmatchedFunctions = unmatchedFunctions; - return this; - } - - public AIDecompFunctionMapping putUnmatchedFunctionsItem(String key, ReplacementValue unmatchedFunctionsItem) { - if (this.unmatchedFunctions == null) { - this.unmatchedFunctions = new HashMap<>(); - } - this.unmatchedFunctions.put(key, unmatchedFunctionsItem); - return this; - } - - /** - * Get unmatchedFunctions - * @return unmatchedFunctions - */ - @javax.annotation.Nonnull - public Map getUnmatchedFunctions() { - return unmatchedFunctions; - } - - public void setUnmatchedFunctions(@javax.annotation.Nonnull Map unmatchedFunctions) { - this.unmatchedFunctions = unmatchedFunctions; - } - - - public AIDecompFunctionMapping unmatchedGlobalVars(@javax.annotation.Nonnull Map unmatchedGlobalVars) { - this.unmatchedGlobalVars = unmatchedGlobalVars; - return this; - } - - public AIDecompFunctionMapping putUnmatchedGlobalVarsItem(String key, ReplacementValue unmatchedGlobalVarsItem) { - if (this.unmatchedGlobalVars == null) { - this.unmatchedGlobalVars = new HashMap<>(); - } - this.unmatchedGlobalVars.put(key, unmatchedGlobalVarsItem); - return this; - } - - /** - * Get unmatchedGlobalVars - * @return unmatchedGlobalVars - */ - @javax.annotation.Nonnull - public Map getUnmatchedGlobalVars() { - return unmatchedGlobalVars; - } - - public void setUnmatchedGlobalVars(@javax.annotation.Nonnull Map unmatchedGlobalVars) { - this.unmatchedGlobalVars = unmatchedGlobalVars; - } - - - public AIDecompFunctionMapping unmatchedGoToLabels(@javax.annotation.Nonnull Map unmatchedGoToLabels) { - this.unmatchedGoToLabels = unmatchedGoToLabels; - return this; - } - - public AIDecompFunctionMapping putUnmatchedGoToLabelsItem(String key, ReplacementValue unmatchedGoToLabelsItem) { - if (this.unmatchedGoToLabels == null) { - this.unmatchedGoToLabels = new HashMap<>(); - } - this.unmatchedGoToLabels.put(key, unmatchedGoToLabelsItem); - return this; - } - - /** - * Get unmatchedGoToLabels - * @return unmatchedGoToLabels - */ - @javax.annotation.Nonnull - public Map getUnmatchedGoToLabels() { - return unmatchedGoToLabels; - } - - public void setUnmatchedGoToLabels(@javax.annotation.Nonnull Map unmatchedGoToLabels) { - this.unmatchedGoToLabels = unmatchedGoToLabels; - } - - - public AIDecompFunctionMapping unmatchedStrings(@javax.annotation.Nonnull Map unmatchedStrings) { - this.unmatchedStrings = unmatchedStrings; - return this; - } - - public AIDecompFunctionMapping putUnmatchedStringsItem(String key, ReplacementValue unmatchedStringsItem) { - if (this.unmatchedStrings == null) { - this.unmatchedStrings = new HashMap<>(); - } - this.unmatchedStrings.put(key, unmatchedStringsItem); - return this; - } - - /** - * Get unmatchedStrings - * @return unmatchedStrings - */ - @javax.annotation.Nonnull - public Map getUnmatchedStrings() { - return unmatchedStrings; - } - - public void setUnmatchedStrings(@javax.annotation.Nonnull Map unmatchedStrings) { - this.unmatchedStrings = unmatchedStrings; - } - - - public AIDecompFunctionMapping unmatchedVariadicLists(@javax.annotation.Nonnull Map unmatchedVariadicLists) { - this.unmatchedVariadicLists = unmatchedVariadicLists; - return this; - } - - public AIDecompFunctionMapping putUnmatchedVariadicListsItem(String key, ReplacementValue unmatchedVariadicListsItem) { - if (this.unmatchedVariadicLists == null) { - this.unmatchedVariadicLists = new HashMap<>(); - } - this.unmatchedVariadicLists.put(key, unmatchedVariadicListsItem); - return this; - } - - /** - * Get unmatchedVariadicLists - * @return unmatchedVariadicLists - */ - @javax.annotation.Nonnull - public Map getUnmatchedVariadicLists() { - return unmatchedVariadicLists; - } - - public void setUnmatchedVariadicLists(@javax.annotation.Nonnull Map unmatchedVariadicLists) { - this.unmatchedVariadicLists = unmatchedVariadicLists; - } - - - public AIDecompFunctionMapping unmatchedVars(@javax.annotation.Nonnull Map unmatchedVars) { - this.unmatchedVars = unmatchedVars; - return this; - } - - public AIDecompFunctionMapping putUnmatchedVarsItem(String key, ReplacementValue unmatchedVarsItem) { - if (this.unmatchedVars == null) { - this.unmatchedVars = new HashMap<>(); - } - this.unmatchedVars.put(key, unmatchedVarsItem); - return this; - } - - /** - * Get unmatchedVars - * @return unmatchedVars - */ - @javax.annotation.Nonnull - public Map getUnmatchedVars() { - return unmatchedVars; - } - - public void setUnmatchedVars(@javax.annotation.Nonnull Map unmatchedVars) { - this.unmatchedVars = unmatchedVars; - } - - - public AIDecompFunctionMapping userOverrideMappings(@javax.annotation.Nonnull Map userOverrideMappings) { - this.userOverrideMappings = userOverrideMappings; - return this; - } - - public AIDecompFunctionMapping putUserOverrideMappingsItem(String key, String userOverrideMappingsItem) { - if (this.userOverrideMappings == null) { - this.userOverrideMappings = new HashMap<>(); - } - this.userOverrideMappings.put(key, userOverrideMappingsItem); - return this; - } - - /** - * Get userOverrideMappings - * @return userOverrideMappings - */ - @javax.annotation.Nonnull - public Map getUserOverrideMappings() { - return userOverrideMappings; - } - - public void setUserOverrideMappings(@javax.annotation.Nonnull Map userOverrideMappings) { - this.userOverrideMappings = userOverrideMappings; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AIDecompFunctionMapping aiDecompFunctionMapping = (AIDecompFunctionMapping) o; - return Objects.equals(this.fields, aiDecompFunctionMapping.fields) && - Objects.equals(this.inverseFunctionMap, aiDecompFunctionMapping.inverseFunctionMap) && - Objects.equals(this.inverseStringMap, aiDecompFunctionMapping.inverseStringMap) && - Objects.equals(this.unmatchedCustomFunctionPointers, aiDecompFunctionMapping.unmatchedCustomFunctionPointers) && - Objects.equals(this.unmatchedCustomTypes, aiDecompFunctionMapping.unmatchedCustomTypes) && - Objects.equals(this.unmatchedEnums, aiDecompFunctionMapping.unmatchedEnums) && - Objects.equals(this.unmatchedExternalVars, aiDecompFunctionMapping.unmatchedExternalVars) && - Objects.equals(this.unmatchedFunctions, aiDecompFunctionMapping.unmatchedFunctions) && - Objects.equals(this.unmatchedGlobalVars, aiDecompFunctionMapping.unmatchedGlobalVars) && - Objects.equals(this.unmatchedGoToLabels, aiDecompFunctionMapping.unmatchedGoToLabels) && - Objects.equals(this.unmatchedStrings, aiDecompFunctionMapping.unmatchedStrings) && - Objects.equals(this.unmatchedVariadicLists, aiDecompFunctionMapping.unmatchedVariadicLists) && - Objects.equals(this.unmatchedVars, aiDecompFunctionMapping.unmatchedVars) && - Objects.equals(this.userOverrideMappings, aiDecompFunctionMapping.userOverrideMappings); - } - - @Override - public int hashCode() { - return Objects.hash(fields, inverseFunctionMap, inverseStringMap, unmatchedCustomFunctionPointers, unmatchedCustomTypes, unmatchedEnums, unmatchedExternalVars, unmatchedFunctions, unmatchedGlobalVars, unmatchedGoToLabels, unmatchedStrings, unmatchedVariadicLists, unmatchedVars, userOverrideMappings); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AIDecompFunctionMapping {\n"); - sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); - sb.append(" inverseFunctionMap: ").append(toIndentedString(inverseFunctionMap)).append("\n"); - sb.append(" inverseStringMap: ").append(toIndentedString(inverseStringMap)).append("\n"); - sb.append(" unmatchedCustomFunctionPointers: ").append(toIndentedString(unmatchedCustomFunctionPointers)).append("\n"); - sb.append(" unmatchedCustomTypes: ").append(toIndentedString(unmatchedCustomTypes)).append("\n"); - sb.append(" unmatchedEnums: ").append(toIndentedString(unmatchedEnums)).append("\n"); - sb.append(" unmatchedExternalVars: ").append(toIndentedString(unmatchedExternalVars)).append("\n"); - sb.append(" unmatchedFunctions: ").append(toIndentedString(unmatchedFunctions)).append("\n"); - sb.append(" unmatchedGlobalVars: ").append(toIndentedString(unmatchedGlobalVars)).append("\n"); - sb.append(" unmatchedGoToLabels: ").append(toIndentedString(unmatchedGoToLabels)).append("\n"); - sb.append(" unmatchedStrings: ").append(toIndentedString(unmatchedStrings)).append("\n"); - sb.append(" unmatchedVariadicLists: ").append(toIndentedString(unmatchedVariadicLists)).append("\n"); - sb.append(" unmatchedVars: ").append(toIndentedString(unmatchedVars)).append("\n"); - sb.append(" userOverrideMappings: ").append(toIndentedString(userOverrideMappings)).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("fields", "inverse_function_map", "inverse_string_map", "unmatched_custom_function_pointers", "unmatched_custom_types", "unmatched_enums", "unmatched_external_vars", "unmatched_functions", "unmatched_global_vars", "unmatched_go_to_labels", "unmatched_strings", "unmatched_variadic_lists", "unmatched_vars", "user_override_mappings")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("fields", "inverse_function_map", "inverse_string_map", "unmatched_custom_function_pointers", "unmatched_custom_types", "unmatched_enums", "unmatched_external_vars", "unmatched_functions", "unmatched_global_vars", "unmatched_go_to_labels", "unmatched_strings", "unmatched_variadic_lists", "unmatched_vars", "user_override_mappings")); - } - - /** - * 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 AIDecompFunctionMapping - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!AIDecompFunctionMapping.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 AIDecompFunctionMapping is not found in the empty JSON string", AIDecompFunctionMapping.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AIDecompFunctionMapping.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AIDecompFunctionMapping` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AIDecompFunctionMapping.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 (!AIDecompFunctionMapping.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AIDecompFunctionMapping' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AIDecompFunctionMapping.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, AIDecompFunctionMapping value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AIDecompFunctionMapping read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of AIDecompFunctionMapping given an JSON string - * - * @param jsonString JSON string - * @return An instance of AIDecompFunctionMapping - * @throws IOException if the JSON string is invalid with respect to AIDecompFunctionMapping - */ - public static AIDecompFunctionMapping fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AIDecompFunctionMapping.class); - } - - /** - * Convert an instance of AIDecompFunctionMapping to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/AnalysisBasicInfoOutputBody.java b/src/main/java/ai/reveng/model/AnalysisBasicInfoOutputBody.java index cae54379..47839ca9 100644 --- a/src/main/java/ai/reveng/model/AnalysisBasicInfoOutputBody.java +++ b/src/main/java/ai/reveng/model/AnalysisBasicInfoOutputBody.java @@ -146,6 +146,21 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nonnull private Boolean debug; + public static final String SERIALIZED_NAME_DETECTED_ARCHITECTURE = "detected_architecture"; + @SerializedName(SERIALIZED_NAME_DETECTED_ARCHITECTURE) + @javax.annotation.Nonnull + private String detectedArchitecture; + + public static final String SERIALIZED_NAME_DETECTED_BINARY_FORMAT = "detected_binary_format"; + @SerializedName(SERIALIZED_NAME_DETECTED_BINARY_FORMAT) + @javax.annotation.Nonnull + private String detectedBinaryFormat; + + public static final String SERIALIZED_NAME_DETECTED_BINARY_TYPE = "detected_binary_type"; + @SerializedName(SERIALIZED_NAME_DETECTED_BINARY_TYPE) + @javax.annotation.Nonnull + private String detectedBinaryType; + public static final String SERIALIZED_NAME_FUNCTION_COUNT = "function_count"; @SerializedName(SERIALIZED_NAME_FUNCTION_COUNT) @javax.annotation.Nonnull @@ -191,6 +206,21 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nonnull private String sha256Hash; + public static final String SERIALIZED_NAME_SUPPLIED_ARCHITECTURE = "supplied_architecture"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ARCHITECTURE) + @javax.annotation.Nonnull + private String suppliedArchitecture; + + public static final String SERIALIZED_NAME_SUPPLIED_BINARY_FORMAT = "supplied_binary_format"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_BINARY_FORMAT) + @javax.annotation.Nonnull + private String suppliedBinaryFormat; + + public static final String SERIALIZED_NAME_SUPPLIED_BINARY_TYPE = "supplied_binary_type"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_BINARY_TYPE) + @javax.annotation.Nonnull + private String suppliedBinaryType; + public static final String SERIALIZED_NAME_TEAM_ID = "team_id"; @SerializedName(SERIALIZED_NAME_TEAM_ID) @javax.annotation.Nonnull @@ -351,6 +381,63 @@ public void setDebug(@javax.annotation.Nonnull Boolean debug) { } + public AnalysisBasicInfoOutputBody detectedArchitecture(@javax.annotation.Nonnull String detectedArchitecture) { + this.detectedArchitecture = detectedArchitecture; + return this; + } + + /** + * Detected instruction-set architecture; empty when unavailable + * @return detectedArchitecture + */ + @javax.annotation.Nonnull + public String getDetectedArchitecture() { + return detectedArchitecture; + } + + public void setDetectedArchitecture(@javax.annotation.Nonnull String detectedArchitecture) { + this.detectedArchitecture = detectedArchitecture; + } + + + public AnalysisBasicInfoOutputBody detectedBinaryFormat(@javax.annotation.Nonnull String detectedBinaryFormat) { + this.detectedBinaryFormat = detectedBinaryFormat; + return this; + } + + /** + * Detected binary container format; empty when unavailable + * @return detectedBinaryFormat + */ + @javax.annotation.Nonnull + public String getDetectedBinaryFormat() { + return detectedBinaryFormat; + } + + public void setDetectedBinaryFormat(@javax.annotation.Nonnull String detectedBinaryFormat) { + this.detectedBinaryFormat = detectedBinaryFormat; + } + + + public AnalysisBasicInfoOutputBody detectedBinaryType(@javax.annotation.Nonnull String detectedBinaryType) { + this.detectedBinaryType = detectedBinaryType; + return this; + } + + /** + * Detected operating-system platform; empty when unavailable + * @return detectedBinaryType + */ + @javax.annotation.Nonnull + public String getDetectedBinaryType() { + return detectedBinaryType; + } + + public void setDetectedBinaryType(@javax.annotation.Nonnull String detectedBinaryType) { + this.detectedBinaryType = detectedBinaryType; + } + + public AnalysisBasicInfoOutputBody functionCount(@javax.annotation.Nonnull Long functionCount) { this.functionCount = functionCount; return this; @@ -522,6 +609,63 @@ public void setSha256Hash(@javax.annotation.Nonnull String sha256Hash) { } + public AnalysisBasicInfoOutputBody suppliedArchitecture(@javax.annotation.Nonnull String suppliedArchitecture) { + this.suppliedArchitecture = suppliedArchitecture; + return this; + } + + /** + * User-supplied instruction-set architecture; \"AUTO\" when not overridden + * @return suppliedArchitecture + */ + @javax.annotation.Nonnull + public String getSuppliedArchitecture() { + return suppliedArchitecture; + } + + public void setSuppliedArchitecture(@javax.annotation.Nonnull String suppliedArchitecture) { + this.suppliedArchitecture = suppliedArchitecture; + } + + + public AnalysisBasicInfoOutputBody suppliedBinaryFormat(@javax.annotation.Nonnull String suppliedBinaryFormat) { + this.suppliedBinaryFormat = suppliedBinaryFormat; + return this; + } + + /** + * User-supplied binary container format; \"AUTO\" when not overridden + * @return suppliedBinaryFormat + */ + @javax.annotation.Nonnull + public String getSuppliedBinaryFormat() { + return suppliedBinaryFormat; + } + + public void setSuppliedBinaryFormat(@javax.annotation.Nonnull String suppliedBinaryFormat) { + this.suppliedBinaryFormat = suppliedBinaryFormat; + } + + + public AnalysisBasicInfoOutputBody suppliedBinaryType(@javax.annotation.Nonnull String suppliedBinaryType) { + this.suppliedBinaryType = suppliedBinaryType; + return this; + } + + /** + * User-supplied operating-system platform; \"AUTO\" when not overridden + * @return suppliedBinaryType + */ + @javax.annotation.Nonnull + public String getSuppliedBinaryType() { + return suppliedBinaryType; + } + + public void setSuppliedBinaryType(@javax.annotation.Nonnull String suppliedBinaryType) { + this.suppliedBinaryType = suppliedBinaryType; + } + + public AnalysisBasicInfoOutputBody teamId(@javax.annotation.Nonnull Long teamId) { this.teamId = teamId; return this; @@ -559,6 +703,9 @@ public boolean equals(Object o) { Objects.equals(this.binaryUuid, analysisBasicInfoOutputBody.binaryUuid) && Objects.equals(this.creation, analysisBasicInfoOutputBody.creation) && Objects.equals(this.debug, analysisBasicInfoOutputBody.debug) && + Objects.equals(this.detectedArchitecture, analysisBasicInfoOutputBody.detectedArchitecture) && + Objects.equals(this.detectedBinaryFormat, analysisBasicInfoOutputBody.detectedBinaryFormat) && + Objects.equals(this.detectedBinaryType, analysisBasicInfoOutputBody.detectedBinaryType) && Objects.equals(this.functionCount, analysisBasicInfoOutputBody.functionCount) && Objects.equals(this.isAdvanced, analysisBasicInfoOutputBody.isAdvanced) && Objects.equals(this.isOwner, analysisBasicInfoOutputBody.isOwner) && @@ -568,12 +715,15 @@ public boolean equals(Object o) { Objects.equals(this.ownerUsername, analysisBasicInfoOutputBody.ownerUsername) && Objects.equals(this.sequencerVersion, analysisBasicInfoOutputBody.sequencerVersion) && Objects.equals(this.sha256Hash, analysisBasicInfoOutputBody.sha256Hash) && + Objects.equals(this.suppliedArchitecture, analysisBasicInfoOutputBody.suppliedArchitecture) && + Objects.equals(this.suppliedBinaryFormat, analysisBasicInfoOutputBody.suppliedBinaryFormat) && + Objects.equals(this.suppliedBinaryType, analysisBasicInfoOutputBody.suppliedBinaryType) && Objects.equals(this.teamId, analysisBasicInfoOutputBody.teamId); } @Override public int hashCode() { - return Objects.hash(analysisScope, baseAddress, binaryId, binaryName, binarySize, binaryUuid, creation, debug, functionCount, isAdvanced, isOwner, isSystem, modelId, modelName, ownerUsername, sequencerVersion, sha256Hash, teamId); + return Objects.hash(analysisScope, baseAddress, binaryId, binaryName, binarySize, binaryUuid, creation, debug, detectedArchitecture, detectedBinaryFormat, detectedBinaryType, functionCount, isAdvanced, isOwner, isSystem, modelId, modelName, ownerUsername, sequencerVersion, sha256Hash, suppliedArchitecture, suppliedBinaryFormat, suppliedBinaryType, teamId); } @Override @@ -588,6 +738,9 @@ public String toString() { sb.append(" binaryUuid: ").append(toIndentedString(binaryUuid)).append("\n"); sb.append(" creation: ").append(toIndentedString(creation)).append("\n"); sb.append(" debug: ").append(toIndentedString(debug)).append("\n"); + sb.append(" detectedArchitecture: ").append(toIndentedString(detectedArchitecture)).append("\n"); + sb.append(" detectedBinaryFormat: ").append(toIndentedString(detectedBinaryFormat)).append("\n"); + sb.append(" detectedBinaryType: ").append(toIndentedString(detectedBinaryType)).append("\n"); sb.append(" functionCount: ").append(toIndentedString(functionCount)).append("\n"); sb.append(" isAdvanced: ").append(toIndentedString(isAdvanced)).append("\n"); sb.append(" isOwner: ").append(toIndentedString(isOwner)).append("\n"); @@ -597,6 +750,9 @@ public String toString() { sb.append(" ownerUsername: ").append(toIndentedString(ownerUsername)).append("\n"); sb.append(" sequencerVersion: ").append(toIndentedString(sequencerVersion)).append("\n"); sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); + sb.append(" suppliedArchitecture: ").append(toIndentedString(suppliedArchitecture)).append("\n"); + sb.append(" suppliedBinaryFormat: ").append(toIndentedString(suppliedBinaryFormat)).append("\n"); + sb.append(" suppliedBinaryType: ").append(toIndentedString(suppliedBinaryType)).append("\n"); sb.append(" teamId: ").append(toIndentedString(teamId)).append("\n"); sb.append("}"); return sb.toString(); @@ -616,10 +772,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "binary_uuid", "creation", "debug", "function_count", "is_advanced", "is_owner", "is_system", "model_id", "model_name", "owner_username", "sequencer_version", "sha_256_hash", "team_id")); + openapiFields = new HashSet(Arrays.asList("analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "binary_uuid", "creation", "debug", "detected_architecture", "detected_binary_format", "detected_binary_type", "function_count", "is_advanced", "is_owner", "is_system", "model_id", "model_name", "owner_username", "sequencer_version", "sha_256_hash", "supplied_architecture", "supplied_binary_format", "supplied_binary_type", "team_id")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "binary_uuid", "creation", "debug", "function_count", "is_advanced", "is_owner", "is_system", "model_id", "model_name", "owner_username", "sha_256_hash", "team_id")); + openapiRequiredFields = new HashSet(Arrays.asList("analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "binary_uuid", "creation", "debug", "detected_architecture", "detected_binary_format", "detected_binary_type", "function_count", "is_advanced", "is_owner", "is_system", "model_id", "model_name", "owner_username", "sha_256_hash", "supplied_architecture", "supplied_binary_format", "supplied_binary_type", "team_id")); } /** @@ -661,6 +817,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("binary_uuid").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `binary_uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("binary_uuid").toString())); } + if (!jsonObj.get("detected_architecture").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `detected_architecture` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detected_architecture").toString())); + } + if (!jsonObj.get("detected_binary_format").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `detected_binary_format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detected_binary_format").toString())); + } + if (!jsonObj.get("detected_binary_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `detected_binary_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detected_binary_type").toString())); + } if (!jsonObj.get("model_name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `model_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model_name").toString())); } @@ -673,6 +838,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + if (!jsonObj.get("supplied_architecture").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `supplied_architecture` to be a primitive type in the JSON string but got `%s`", jsonObj.get("supplied_architecture").toString())); + } + if (!jsonObj.get("supplied_binary_format").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `supplied_binary_format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("supplied_binary_format").toString())); + } + if (!jsonObj.get("supplied_binary_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `supplied_binary_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("supplied_binary_type").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/ai/reveng/model/ListFunctionsDataTypesOutputBody.java b/src/main/java/ai/reveng/model/AnalysisDataTypesGroup.java similarity index 63% rename from src/main/java/ai/reveng/model/ListFunctionsDataTypesOutputBody.java rename to src/main/java/ai/reveng/model/AnalysisDataTypesGroup.java index a23d010c..57428390 100644 --- a/src/main/java/ai/reveng/model/ListFunctionsDataTypesOutputBody.java +++ b/src/main/java/ai/reveng/model/AnalysisDataTypesGroup.java @@ -13,7 +13,7 @@ package ai.reveng.model; import java.util.Objects; -import ai.reveng.model.DataTypesEntry; +import ai.reveng.model.DataTypeEntry; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -48,24 +48,48 @@ import ai.reveng.invoker.JSON; /** - * ListFunctionsDataTypesOutputBody + * AnalysisDataTypesGroup */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ListFunctionsDataTypesOutputBody { +public class AnalysisDataTypesGroup { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + public static final String SERIALIZED_NAME_ITEMS = "items"; @SerializedName(SERIALIZED_NAME_ITEMS) @javax.annotation.Nullable - private List items; + private List items; + + public AnalysisDataTypesGroup() { + } - public ListFunctionsDataTypesOutputBody() { + public AnalysisDataTypesGroup analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; } - public ListFunctionsDataTypesOutputBody items(@javax.annotation.Nullable List items) { + /** + * Get analysisId + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public AnalysisDataTypesGroup items(@javax.annotation.Nullable List items) { this.items = items; return this; } - public ListFunctionsDataTypesOutputBody addItemsItem(DataTypesEntry itemsItem) { + public AnalysisDataTypesGroup addItemsItem(DataTypeEntry itemsItem) { if (this.items == null) { this.items = new ArrayList<>(); } @@ -74,15 +98,15 @@ public ListFunctionsDataTypesOutputBody addItemsItem(DataTypesEntry itemsItem) { } /** - * Get items + * The analysis's types the returned signatures name, ordered by data_type_id. * @return items */ @javax.annotation.Nullable - public List getItems() { + public List getItems() { return items; } - public void setItems(@javax.annotation.Nullable List items) { + public void setItems(@javax.annotation.Nullable List items) { this.items = items; } @@ -96,19 +120,21 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - ListFunctionsDataTypesOutputBody listFunctionsDataTypesOutputBody = (ListFunctionsDataTypesOutputBody) o; - return Objects.equals(this.items, listFunctionsDataTypesOutputBody.items); + AnalysisDataTypesGroup analysisDataTypesGroup = (AnalysisDataTypesGroup) o; + return Objects.equals(this.analysisId, analysisDataTypesGroup.analysisId) && + Objects.equals(this.items, analysisDataTypesGroup.items); } @Override public int hashCode() { - return Objects.hash(items); + return Objects.hash(analysisId, items); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class ListFunctionsDataTypesOutputBody {\n"); + sb.append("class AnalysisDataTypesGroup {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); sb.append(" items: ").append(toIndentedString(items)).append("\n"); sb.append("}"); return sb.toString(); @@ -128,35 +154,35 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("items")); + openapiFields = new HashSet(Arrays.asList("analysis_id", "items")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("items")); + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "items")); } /** * 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 ListFunctionsDataTypesOutputBody + * @throws IOException if the JSON Element is invalid with respect to AnalysisDataTypesGroup */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!ListFunctionsDataTypesOutputBody.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 ListFunctionsDataTypesOutputBody is not found in the empty JSON string", ListFunctionsDataTypesOutputBody.openapiRequiredFields.toString())); + if (!AnalysisDataTypesGroup.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 AnalysisDataTypesGroup is not found in the empty JSON string", AnalysisDataTypesGroup.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!ListFunctionsDataTypesOutputBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ListFunctionsDataTypesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!AnalysisDataTypesGroup.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AnalysisDataTypesGroup` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ListFunctionsDataTypesOutputBody.openapiRequiredFields) { + for (String requiredField : AnalysisDataTypesGroup.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())); } @@ -169,7 +195,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); // validate the required field `items` (array) for (int i = 0; i < jsonArrayitems.size(); i++) { - DataTypesEntry.validateJsonElement(jsonArrayitems.get(i)); + DataTypeEntry.validateJsonElement(jsonArrayitems.get(i)); } } } @@ -178,22 +204,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!ListFunctionsDataTypesOutputBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ListFunctionsDataTypesOutputBody' and its subtypes + if (!AnalysisDataTypesGroup.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisDataTypesGroup' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ListFunctionsDataTypesOutputBody.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisDataTypesGroup.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, ListFunctionsDataTypesOutputBody value) throws IOException { + public void write(JsonWriter out, AnalysisDataTypesGroup value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public ListFunctionsDataTypesOutputBody read(JsonReader in) throws IOException { + public AnalysisDataTypesGroup read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -204,18 +230,18 @@ public ListFunctionsDataTypesOutputBody read(JsonReader in) throws IOException { } /** - * Create an instance of ListFunctionsDataTypesOutputBody given an JSON string + * Create an instance of AnalysisDataTypesGroup given an JSON string * * @param jsonString JSON string - * @return An instance of ListFunctionsDataTypesOutputBody - * @throws IOException if the JSON string is invalid with respect to ListFunctionsDataTypesOutputBody + * @return An instance of AnalysisDataTypesGroup + * @throws IOException if the JSON string is invalid with respect to AnalysisDataTypesGroup */ - public static ListFunctionsDataTypesOutputBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ListFunctionsDataTypesOutputBody.class); + public static AnalysisDataTypesGroup fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisDataTypesGroup.class); } /** - * Convert an instance of ListFunctionsDataTypesOutputBody to an JSON string + * Convert an instance of AnalysisDataTypesGroup to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/UpdateDataTypesInputBody.java b/src/main/java/ai/reveng/model/AnalysisDataTypesOutputBody.java similarity index 61% rename from src/main/java/ai/reveng/model/UpdateDataTypesInputBody.java rename to src/main/java/ai/reveng/model/AnalysisDataTypesOutputBody.java index 2cbf8882..cbb39e5c 100644 --- a/src/main/java/ai/reveng/model/UpdateDataTypesInputBody.java +++ b/src/main/java/ai/reveng/model/AnalysisDataTypesOutputBody.java @@ -13,13 +13,16 @@ package ai.reveng.model; import java.util.Objects; +import ai.reveng.model.DataTypeEntry; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -45,62 +48,45 @@ import ai.reveng.invoker.JSON; /** - * UpdateDataTypesInputBody + * AnalysisDataTypesOutputBody */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class UpdateDataTypesInputBody { +public class AnalysisDataTypesOutputBody { public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; @SerializedName(SERIALIZED_NAME_DATA_TYPES) @javax.annotation.Nullable - private Object dataTypes = null; - - public static final String SERIALIZED_NAME_DATA_TYPES_VERSION = "data_types_version"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_VERSION) - @javax.annotation.Nonnull - private Long dataTypesVersion; + private List dataTypes; - public UpdateDataTypesInputBody() { + public AnalysisDataTypesOutputBody() { } - public UpdateDataTypesInputBody dataTypes(@javax.annotation.Nullable Object dataTypes) { + public AnalysisDataTypesOutputBody dataTypes(@javax.annotation.Nullable List dataTypes) { this.dataTypes = dataTypes; return this; } + public AnalysisDataTypesOutputBody addDataTypesItem(DataTypeEntry dataTypesItem) { + if (this.dataTypes == null) { + this.dataTypes = new ArrayList<>(); + } + this.dataTypes.add(dataTypesItem); + return this; + } + /** - * Get dataTypes + * The stored types, ordered by data_type_id. * @return dataTypes */ @javax.annotation.Nullable - public Object getDataTypes() { + public List getDataTypes() { return dataTypes; } - public void setDataTypes(@javax.annotation.Nullable Object dataTypes) { + public void setDataTypes(@javax.annotation.Nullable List dataTypes) { this.dataTypes = dataTypes; } - public UpdateDataTypesInputBody dataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - return this; - } - - /** - * Current version of the function data types. The update is rejected if the stored version has moved on. Pass 0 on the first write. - * minimum: 0 - * @return dataTypesVersion - */ - @javax.annotation.Nonnull - public Long getDataTypesVersion() { - return dataTypesVersion; - } - - public void setDataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - } - - @Override public boolean equals(Object o) { @@ -110,22 +96,20 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - UpdateDataTypesInputBody updateDataTypesInputBody = (UpdateDataTypesInputBody) o; - return Objects.equals(this.dataTypes, updateDataTypesInputBody.dataTypes) && - Objects.equals(this.dataTypesVersion, updateDataTypesInputBody.dataTypesVersion); + AnalysisDataTypesOutputBody analysisDataTypesOutputBody = (AnalysisDataTypesOutputBody) o; + return Objects.equals(this.dataTypes, analysisDataTypesOutputBody.dataTypes); } @Override public int hashCode() { - return Objects.hash(dataTypes, dataTypesVersion); + return Objects.hash(dataTypes); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class UpdateDataTypesInputBody {\n"); + sb.append("class AnalysisDataTypesOutputBody {\n"); sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); - sb.append(" dataTypesVersion: ").append(toIndentedString(dataTypesVersion)).append("\n"); sb.append("}"); return sb.toString(); } @@ -144,62 +128,72 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("data_types", "data_types_version")); + openapiFields = new HashSet(Arrays.asList("data_types")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("data_types", "data_types_version")); + openapiRequiredFields = new HashSet(Arrays.asList("data_types")); } /** * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateDataTypesInputBody + * @throws IOException if the JSON Element is invalid with respect to AnalysisDataTypesOutputBody */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!UpdateDataTypesInputBody.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 UpdateDataTypesInputBody is not found in the empty JSON string", UpdateDataTypesInputBody.openapiRequiredFields.toString())); + if (!AnalysisDataTypesOutputBody.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 AnalysisDataTypesOutputBody is not found in the empty JSON string", AnalysisDataTypesOutputBody.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!UpdateDataTypesInputBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateDataTypesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!AnalysisDataTypesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AnalysisDataTypesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateDataTypesInputBody.openapiRequiredFields) { + for (String requiredField : AnalysisDataTypesOutputBody.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("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { + if (!jsonObj.get("data_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data_types` to be an array in the JSON string but got `%s`", jsonObj.get("data_types").toString())); + } + JsonArray jsonArraydataTypes = jsonObj.getAsJsonArray("data_types"); + // validate the required field `data_types` (array) + for (int i = 0; i < jsonArraydataTypes.size(); i++) { + DataTypeEntry.validateJsonElement(jsonArraydataTypes.get(i)); + } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateDataTypesInputBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateDataTypesInputBody' and its subtypes + if (!AnalysisDataTypesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisDataTypesOutputBody' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateDataTypesInputBody.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisDataTypesOutputBody.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, UpdateDataTypesInputBody value) throws IOException { + public void write(JsonWriter out, AnalysisDataTypesOutputBody value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public UpdateDataTypesInputBody read(JsonReader in) throws IOException { + public AnalysisDataTypesOutputBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -210,18 +204,18 @@ public UpdateDataTypesInputBody read(JsonReader in) throws IOException { } /** - * Create an instance of UpdateDataTypesInputBody given an JSON string + * Create an instance of AnalysisDataTypesOutputBody given an JSON string * * @param jsonString JSON string - * @return An instance of UpdateDataTypesInputBody - * @throws IOException if the JSON string is invalid with respect to UpdateDataTypesInputBody + * @return An instance of AnalysisDataTypesOutputBody + * @throws IOException if the JSON string is invalid with respect to AnalysisDataTypesOutputBody */ - public static UpdateDataTypesInputBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateDataTypesInputBody.class); + public static AnalysisDataTypesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisDataTypesOutputBody.class); } /** - * Convert an instance of UpdateDataTypesInputBody to an JSON string + * Convert an instance of AnalysisDataTypesOutputBody to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/AnalysisLogEntry.java b/src/main/java/ai/reveng/model/AnalysisLogEntry.java new file mode 100644 index 00000000..da632ed3 --- /dev/null +++ b/src/main/java/ai/reveng/model/AnalysisLogEntry.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.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; + +/** + * AnalysisLogEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class AnalysisLogEntry { + /** + * Severity + */ + @JsonAdapter(LevelEnum.Adapter.class) + public enum LevelEnum { + INFO("INFO"), + + WARN("WARN"), + + ERROR("ERROR"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + LevelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LevelEnum fromValue(String value) { + for (LevelEnum b : LevelEnum.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 LevelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LevelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LevelEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + LevelEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_LEVEL = "level"; + @SerializedName(SERIALIZED_NAME_LEVEL) + @javax.annotation.Nonnull + private LevelEnum level; + + public static final String SERIALIZED_NAME_SOURCE = "source"; + @SerializedName(SERIALIZED_NAME_SOURCE) + @javax.annotation.Nonnull + private String source; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nonnull + private String text; + + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + @javax.annotation.Nonnull + private OffsetDateTime timestamp; + + public AnalysisLogEntry() { + } + + public AnalysisLogEntry level(@javax.annotation.Nonnull LevelEnum level) { + this.level = level; + return this; + } + + /** + * Severity + * @return level + */ + @javax.annotation.Nonnull + public LevelEnum getLevel() { + return level; + } + + public void setLevel(@javax.annotation.Nonnull LevelEnum level) { + this.level = level; + } + + + public AnalysisLogEntry source(@javax.annotation.Nonnull String source) { + this.source = source; + return this; + } + + /** + * Component that emitted the line + * @return source + */ + @javax.annotation.Nonnull + public String getSource() { + return source; + } + + public void setSource(@javax.annotation.Nonnull String source) { + this.source = source; + } + + + public AnalysisLogEntry text(@javax.annotation.Nonnull String text) { + this.text = text; + return this; + } + + /** + * Log line text + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nonnull String text) { + this.text = text; + } + + + public AnalysisLogEntry timestamp(@javax.annotation.Nonnull OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * When the line was emitted (UTC) + * @return timestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getTimestamp() { + return timestamp; + } + + public void setTimestamp(@javax.annotation.Nonnull OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnalysisLogEntry analysisLogEntry = (AnalysisLogEntry) o; + return Objects.equals(this.level, analysisLogEntry.level) && + Objects.equals(this.source, analysisLogEntry.source) && + Objects.equals(this.text, analysisLogEntry.text) && + Objects.equals(this.timestamp, analysisLogEntry.timestamp); + } + + @Override + public int hashCode() { + return Objects.hash(level, source, text, timestamp); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisLogEntry {\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).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("level", "source", "text", "timestamp")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("level", "source", "text", "timestamp")); + } + + /** + * 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 AnalysisLogEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnalysisLogEntry.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 AnalysisLogEntry is not found in the empty JSON string", AnalysisLogEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AnalysisLogEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AnalysisLogEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AnalysisLogEntry.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("level").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `level` to be a primitive type in the JSON string but got `%s`", jsonObj.get("level").toString())); + } + // validate the required field `level` + LevelEnum.validateJsonElement(jsonObj.get("level")); + if (!jsonObj.get("source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source").toString())); + } + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnalysisLogEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnalysisLogEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnalysisLogEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnalysisLogEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AnalysisLogEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnalysisLogEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnalysisLogEntry + * @throws IOException if the JSON string is invalid with respect to AnalysisLogEntry + */ + public static AnalysisLogEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnalysisLogEntry.class); + } + + /** + * Convert an instance of AnalysisLogEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AnalysisRecordBody.java b/src/main/java/ai/reveng/model/AnalysisRecordBody.java index 3c62e13b..2c1816eb 100644 --- a/src/main/java/ai/reveng/model/AnalysisRecordBody.java +++ b/src/main/java/ai/reveng/model/AnalysisRecordBody.java @@ -144,6 +144,21 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nonnull private OffsetDateTime creation; + public static final String SERIALIZED_NAME_DETECTED_ARCHITECTURE = "detected_architecture"; + @SerializedName(SERIALIZED_NAME_DETECTED_ARCHITECTURE) + @javax.annotation.Nonnull + private String detectedArchitecture; + + public static final String SERIALIZED_NAME_DETECTED_BINARY_FORMAT = "detected_binary_format"; + @SerializedName(SERIALIZED_NAME_DETECTED_BINARY_FORMAT) + @javax.annotation.Nonnull + private String detectedBinaryFormat; + + public static final String SERIALIZED_NAME_DETECTED_BINARY_TYPE = "detected_binary_type"; + @SerializedName(SERIALIZED_NAME_DETECTED_BINARY_TYPE) + @javax.annotation.Nonnull + private String detectedBinaryType; + public static final String SERIALIZED_NAME_FUNCTION_BOUNDARIES_HASH = "function_boundaries_hash"; @SerializedName(SERIALIZED_NAME_FUNCTION_BOUNDARIES_HASH) @javax.annotation.Nonnull @@ -174,6 +189,21 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nonnull private String status; + public static final String SERIALIZED_NAME_SUPPLIED_ARCHITECTURE = "supplied_architecture"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_ARCHITECTURE) + @javax.annotation.Nonnull + private String suppliedArchitecture; + + public static final String SERIALIZED_NAME_SUPPLIED_BINARY_FORMAT = "supplied_binary_format"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_BINARY_FORMAT) + @javax.annotation.Nonnull + private String suppliedBinaryFormat; + + public static final String SERIALIZED_NAME_SUPPLIED_BINARY_TYPE = "supplied_binary_type"; + @SerializedName(SERIALIZED_NAME_SUPPLIED_BINARY_TYPE) + @javax.annotation.Nonnull + private String suppliedBinaryType; + public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) @javax.annotation.Nullable @@ -320,6 +350,63 @@ public void setCreation(@javax.annotation.Nonnull OffsetDateTime creation) { } + public AnalysisRecordBody detectedArchitecture(@javax.annotation.Nonnull String detectedArchitecture) { + this.detectedArchitecture = detectedArchitecture; + return this; + } + + /** + * Detected instruction-set architecture; empty when unavailable + * @return detectedArchitecture + */ + @javax.annotation.Nonnull + public String getDetectedArchitecture() { + return detectedArchitecture; + } + + public void setDetectedArchitecture(@javax.annotation.Nonnull String detectedArchitecture) { + this.detectedArchitecture = detectedArchitecture; + } + + + public AnalysisRecordBody detectedBinaryFormat(@javax.annotation.Nonnull String detectedBinaryFormat) { + this.detectedBinaryFormat = detectedBinaryFormat; + return this; + } + + /** + * Detected binary container format; empty when unavailable + * @return detectedBinaryFormat + */ + @javax.annotation.Nonnull + public String getDetectedBinaryFormat() { + return detectedBinaryFormat; + } + + public void setDetectedBinaryFormat(@javax.annotation.Nonnull String detectedBinaryFormat) { + this.detectedBinaryFormat = detectedBinaryFormat; + } + + + public AnalysisRecordBody detectedBinaryType(@javax.annotation.Nonnull String detectedBinaryType) { + this.detectedBinaryType = detectedBinaryType; + return this; + } + + /** + * Detected operating-system platform; empty when unavailable + * @return detectedBinaryType + */ + @javax.annotation.Nonnull + public String getDetectedBinaryType() { + return detectedBinaryType; + } + + public void setDetectedBinaryType(@javax.annotation.Nonnull String detectedBinaryType) { + this.detectedBinaryType = detectedBinaryType; + } + + public AnalysisRecordBody functionBoundariesHash(@javax.annotation.Nonnull String functionBoundariesHash) { this.functionBoundariesHash = functionBoundariesHash; return this; @@ -434,6 +521,63 @@ public void setStatus(@javax.annotation.Nonnull String status) { } + public AnalysisRecordBody suppliedArchitecture(@javax.annotation.Nonnull String suppliedArchitecture) { + this.suppliedArchitecture = suppliedArchitecture; + return this; + } + + /** + * User-supplied instruction-set architecture; \"AUTO\" when not overridden + * @return suppliedArchitecture + */ + @javax.annotation.Nonnull + public String getSuppliedArchitecture() { + return suppliedArchitecture; + } + + public void setSuppliedArchitecture(@javax.annotation.Nonnull String suppliedArchitecture) { + this.suppliedArchitecture = suppliedArchitecture; + } + + + public AnalysisRecordBody suppliedBinaryFormat(@javax.annotation.Nonnull String suppliedBinaryFormat) { + this.suppliedBinaryFormat = suppliedBinaryFormat; + return this; + } + + /** + * User-supplied binary container format; \"AUTO\" when not overridden + * @return suppliedBinaryFormat + */ + @javax.annotation.Nonnull + public String getSuppliedBinaryFormat() { + return suppliedBinaryFormat; + } + + public void setSuppliedBinaryFormat(@javax.annotation.Nonnull String suppliedBinaryFormat) { + this.suppliedBinaryFormat = suppliedBinaryFormat; + } + + + public AnalysisRecordBody suppliedBinaryType(@javax.annotation.Nonnull String suppliedBinaryType) { + this.suppliedBinaryType = suppliedBinaryType; + return this; + } + + /** + * User-supplied operating-system platform; \"AUTO\" when not overridden + * @return suppliedBinaryType + */ + @javax.annotation.Nonnull + public String getSuppliedBinaryType() { + return suppliedBinaryType; + } + + public void setSuppliedBinaryType(@javax.annotation.Nonnull String suppliedBinaryType) { + this.suppliedBinaryType = suppliedBinaryType; + } + + public AnalysisRecordBody tags(@javax.annotation.Nullable List tags) { this.tags = tags; return this; @@ -541,12 +685,18 @@ public boolean equals(Object o) { Objects.equals(this.binaryName, analysisRecordBody.binaryName) && Objects.equals(this.binarySize, analysisRecordBody.binarySize) && Objects.equals(this.creation, analysisRecordBody.creation) && + Objects.equals(this.detectedArchitecture, analysisRecordBody.detectedArchitecture) && + Objects.equals(this.detectedBinaryFormat, analysisRecordBody.detectedBinaryFormat) && + Objects.equals(this.detectedBinaryType, analysisRecordBody.detectedBinaryType) && Objects.equals(this.functionBoundariesHash, analysisRecordBody.functionBoundariesHash) && Objects.equals(this.isOwner, analysisRecordBody.isOwner) && Objects.equals(this.modelId, analysisRecordBody.modelId) && Objects.equals(this.modelName, analysisRecordBody.modelName) && Objects.equals(this.sha256Hash, analysisRecordBody.sha256Hash) && Objects.equals(this.status, analysisRecordBody.status) && + Objects.equals(this.suppliedArchitecture, analysisRecordBody.suppliedArchitecture) && + Objects.equals(this.suppliedBinaryFormat, analysisRecordBody.suppliedBinaryFormat) && + Objects.equals(this.suppliedBinaryType, analysisRecordBody.suppliedBinaryType) && Objects.equals(this.tags, analysisRecordBody.tags) && Objects.equals(this.username, analysisRecordBody.username)&& Objects.equals(this.additionalProperties, analysisRecordBody.additionalProperties); @@ -554,7 +704,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(analysisId, analysisScope, baseAddress, binaryId, binaryName, binarySize, creation, functionBoundariesHash, isOwner, modelId, modelName, sha256Hash, status, tags, username, additionalProperties); + return Objects.hash(analysisId, analysisScope, baseAddress, binaryId, binaryName, binarySize, creation, detectedArchitecture, detectedBinaryFormat, detectedBinaryType, functionBoundariesHash, isOwner, modelId, modelName, sha256Hash, status, suppliedArchitecture, suppliedBinaryFormat, suppliedBinaryType, tags, username, additionalProperties); } @Override @@ -568,12 +718,18 @@ public String toString() { sb.append(" binaryName: ").append(toIndentedString(binaryName)).append("\n"); sb.append(" binarySize: ").append(toIndentedString(binarySize)).append("\n"); sb.append(" creation: ").append(toIndentedString(creation)).append("\n"); + sb.append(" detectedArchitecture: ").append(toIndentedString(detectedArchitecture)).append("\n"); + sb.append(" detectedBinaryFormat: ").append(toIndentedString(detectedBinaryFormat)).append("\n"); + sb.append(" detectedBinaryType: ").append(toIndentedString(detectedBinaryType)).append("\n"); sb.append(" functionBoundariesHash: ").append(toIndentedString(functionBoundariesHash)).append("\n"); sb.append(" isOwner: ").append(toIndentedString(isOwner)).append("\n"); sb.append(" modelId: ").append(toIndentedString(modelId)).append("\n"); sb.append(" modelName: ").append(toIndentedString(modelName)).append("\n"); sb.append(" sha256Hash: ").append(toIndentedString(sha256Hash)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" suppliedArchitecture: ").append(toIndentedString(suppliedArchitecture)).append("\n"); + sb.append(" suppliedBinaryFormat: ").append(toIndentedString(suppliedBinaryFormat)).append("\n"); + sb.append(" suppliedBinaryType: ").append(toIndentedString(suppliedBinaryType)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" username: ").append(toIndentedString(username)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -595,10 +751,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("analysis_id", "analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "creation", "function_boundaries_hash", "is_owner", "model_id", "model_name", "sha_256_hash", "status", "tags", "username")); + openapiFields = new HashSet(Arrays.asList("analysis_id", "analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "creation", "detected_architecture", "detected_binary_format", "detected_binary_type", "function_boundaries_hash", "is_owner", "model_id", "model_name", "sha_256_hash", "status", "supplied_architecture", "supplied_binary_format", "supplied_binary_type", "tags", "username")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "creation", "function_boundaries_hash", "is_owner", "model_id", "model_name", "sha_256_hash", "status", "tags", "username")); + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "analysis_scope", "base_address", "binary_id", "binary_name", "binary_size", "creation", "detected_architecture", "detected_binary_format", "detected_binary_type", "function_boundaries_hash", "is_owner", "model_id", "model_name", "sha_256_hash", "status", "supplied_architecture", "supplied_binary_format", "supplied_binary_type", "tags", "username")); } /** @@ -629,6 +785,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("binary_name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `binary_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("binary_name").toString())); } + if (!jsonObj.get("detected_architecture").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `detected_architecture` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detected_architecture").toString())); + } + if (!jsonObj.get("detected_binary_format").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `detected_binary_format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detected_binary_format").toString())); + } + if (!jsonObj.get("detected_binary_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `detected_binary_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("detected_binary_type").toString())); + } if (!jsonObj.get("function_boundaries_hash").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_boundaries_hash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_boundaries_hash").toString())); } @@ -641,6 +806,15 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + if (!jsonObj.get("supplied_architecture").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `supplied_architecture` to be a primitive type in the JSON string but got `%s`", jsonObj.get("supplied_architecture").toString())); + } + if (!jsonObj.get("supplied_binary_format").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `supplied_binary_format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("supplied_binary_format").toString())); + } + if (!jsonObj.get("supplied_binary_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `supplied_binary_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("supplied_binary_type").toString())); + } if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { if (!jsonObj.get("tags").isJsonArray()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); diff --git a/src/main/java/ai/reveng/model/Argument.java b/src/main/java/ai/reveng/model/Argument.java deleted file mode 100644 index 796ee044..00000000 --- a/src/main/java/ai/reveng/model/Argument.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * 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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * Argument - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Argument { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_OFFSET = "offset"; - @SerializedName(SERIALIZED_NAME_OFFSET) - @javax.annotation.Nonnull - private Integer offset; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_SIZE = "size"; - @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nonnull - private Integer size; - - public Argument() { - } - - public Argument lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this argument - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public Argument offset(@javax.annotation.Nonnull Integer offset) { - this.offset = offset; - return this; - } - - /** - * Offset of the argument in the function signature - * @return offset - */ - @javax.annotation.Nonnull - public Integer getOffset() { - return offset; - } - - public void setOffset(@javax.annotation.Nonnull Integer offset) { - this.offset = offset; - } - - - public Argument name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the argument - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public Argument type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Data type of the argument - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public Argument size(@javax.annotation.Nonnull Integer size) { - this.size = size; - return this; - } - - /** - * Size of the argument in bytes - * @return size - */ - @javax.annotation.Nonnull - public Integer getSize() { - return size; - } - - public void setSize(@javax.annotation.Nonnull Integer size) { - this.size = size; - } - - /** - * 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 Argument instance itself - */ - public Argument 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; - } - Argument argument = (Argument) o; - return Objects.equals(this.lastChange, argument.lastChange) && - Objects.equals(this.offset, argument.offset) && - Objects.equals(this.name, argument.name) && - Objects.equals(this.type, argument.type) && - Objects.equals(this.size, argument.size)&& - Objects.equals(this.additionalProperties, argument.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, offset, name, type, size, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Argument {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).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("last_change", "offset", "name", "type", "size")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("offset", "name", "type", "size")); - } - - /** - * 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 Argument - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Argument.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 Argument is not found in the empty JSON string", Argument.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Argument.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Argument.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Argument' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Argument.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Argument 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 Argument read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Argument 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 Argument given an JSON string - * - * @param jsonString JSON string - * @return An instance of Argument - * @throws IOException if the JSON string is invalid with respect to Argument - */ - public static Argument fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Argument.class); - } - - /** - * Convert an instance of Argument to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/ArrayDataType.java b/src/main/java/ai/reveng/model/ArrayDataType.java new file mode 100644 index 00000000..cceb1cbb --- /dev/null +++ b/src/main/java/ai/reveng/model/ArrayDataType.java @@ -0,0 +1,571 @@ +/* + * 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.ArrayDefinition; +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; + +/** + * ArrayDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ArrayDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private ArrayDefinition definition; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + ARRAY("ARRAY"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public ArrayDataType() { + } + + public ArrayDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ArrayDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public ArrayDataType definition(@javax.annotation.Nullable ArrayDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Absent only for a type referenced but never defined. + * @return definition + */ + @javax.annotation.Nullable + public ArrayDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable ArrayDefinition definition) { + this.definition = definition; + } + + + public ArrayDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public ArrayDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public ArrayDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public ArrayDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public ArrayDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public ArrayDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public ArrayDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayDataType arrayDataType = (ArrayDataType) o; + return Objects.equals(this.createdAt, arrayDataType.createdAt) && + Objects.equals(this.dataTypeId, arrayDataType.dataTypeId) && + Objects.equals(this.definition, arrayDataType.definition) && + Objects.equals(this.hasDefinition, arrayDataType.hasDefinition) && + Objects.equals(this.kind, arrayDataType.kind) && + Objects.equals(this.name, arrayDataType.name) && + Objects.equals(this.namespace, arrayDataType.namespace) && + Objects.equals(this.size, arrayDataType.size) && + Objects.equals(this.sourceFunctionId, arrayDataType.sourceFunctionId) && + Objects.equals(this.sourceType, arrayDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, definition, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "definition", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayDataType.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 ArrayDataType is not found in the empty JSON string", ArrayDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ArrayDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ArrayDataType.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(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + ArrayDefinition.validateJsonElement(jsonObj.get("definition")); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ArrayDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayDataType + * @throws IOException if the JSON string is invalid with respect to ArrayDataType + */ + public static ArrayDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayDataType.class); + } + + /** + * Convert an instance of ArrayDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ArrayDefinition.java b/src/main/java/ai/reveng/model/ArrayDefinition.java new file mode 100644 index 00000000..87ef1f37 --- /dev/null +++ b/src/main/java/ai/reveng/model/ArrayDefinition.java @@ -0,0 +1,224 @@ +/* + * 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; + +/** + * ArrayDefinition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ArrayDefinition { + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Long count; + + public static final String SERIALIZED_NAME_ELEMENT_DATA_TYPE_ID = "element_data_type_id"; + @SerializedName(SERIALIZED_NAME_ELEMENT_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long elementDataTypeId; + + public ArrayDefinition() { + } + + public ArrayDefinition count(@javax.annotation.Nullable Long count) { + this.count = count; + return this; + } + + /** + * Element count. Zero is a genuinely empty trailing array; absent means it could not be determined. + * @return count + */ + @javax.annotation.Nullable + public Long getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Long count) { + this.count = count; + } + + + public ArrayDefinition elementDataTypeId(@javax.annotation.Nullable Long elementDataTypeId) { + this.elementDataTypeId = elementDataTypeId; + return this; + } + + /** + * The element type. + * @return elementDataTypeId + */ + @javax.annotation.Nullable + public Long getElementDataTypeId() { + return elementDataTypeId; + } + + public void setElementDataTypeId(@javax.annotation.Nullable Long elementDataTypeId) { + this.elementDataTypeId = elementDataTypeId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayDefinition arrayDefinition = (ArrayDefinition) o; + return Objects.equals(this.count, arrayDefinition.count) && + Objects.equals(this.elementDataTypeId, arrayDefinition.elementDataTypeId); + } + + @Override + public int hashCode() { + return Objects.hash(count, elementDataTypeId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayDefinition {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" elementDataTypeId: ").append(toIndentedString(elementDataTypeId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("count", "element_data_type_id")); + + // 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 ArrayDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayDefinition.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 ArrayDefinition is not found in the empty JSON string", ArrayDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ArrayDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ArrayDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayDefinition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayDefinition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ArrayDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ArrayDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayDefinition + * @throws IOException if the JSON string is invalid with respect to ArrayDefinition + */ + public static ArrayDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayDefinition.class); + } + + /** + * Convert an instance of ArrayDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseDataType.java b/src/main/java/ai/reveng/model/BaseDataType.java new file mode 100644 index 00000000..747ed149 --- /dev/null +++ b/src/main/java/ai/reveng/model/BaseDataType.java @@ -0,0 +1,540 @@ +/* + * 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; + +/** + * BaseDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BaseDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + BASE("BASE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public BaseDataType() { + } + + public BaseDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BaseDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public BaseDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public BaseDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public BaseDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public BaseDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public BaseDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public BaseDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public BaseDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BaseDataType baseDataType = (BaseDataType) o; + return Objects.equals(this.createdAt, baseDataType.createdAt) && + Objects.equals(this.dataTypeId, baseDataType.dataTypeId) && + Objects.equals(this.hasDefinition, baseDataType.hasDefinition) && + Objects.equals(this.kind, baseDataType.kind) && + Objects.equals(this.name, baseDataType.name) && + Objects.equals(this.namespace, baseDataType.namespace) && + Objects.equals(this.size, baseDataType.size) && + Objects.equals(this.sourceFunctionId, baseDataType.sourceFunctionId) && + Objects.equals(this.sourceType, baseDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BaseDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BaseDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BaseDataType.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 BaseDataType is not found in the empty JSON string", BaseDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BaseDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BaseDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BaseDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BaseDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BaseDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BaseDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BaseDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BaseDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BaseDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of BaseDataType + * @throws IOException if the JSON string is invalid with respect to BaseDataType + */ + public static BaseDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BaseDataType.class); + } + + /** + * Convert an instance of BaseDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BaseResponseFunctionDataTypes.java b/src/main/java/ai/reveng/model/BaseResponseFunctionDataTypes.java deleted file mode 100644 index c705204f..00000000 --- a/src/main/java/ai/reveng/model/BaseResponseFunctionDataTypes.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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.ErrorModel; -import ai.reveng.model.FunctionDataTypes; -import ai.reveng.model.MetaModel; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * BaseResponseFunctionDataTypes - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseFunctionDataTypes { - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private Boolean status = true; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - @javax.annotation.Nullable - private FunctionDataTypes data; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; - - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - @javax.annotation.Nullable - private List errors; - - public static final String SERIALIZED_NAME_META = "meta"; - @SerializedName(SERIALIZED_NAME_META) - @javax.annotation.Nullable - private MetaModel meta; - - public BaseResponseFunctionDataTypes() { - } - - public BaseResponseFunctionDataTypes status(@javax.annotation.Nullable Boolean status) { - this.status = status; - return this; - } - - /** - * Response status on whether the request succeeded - * @return status - */ - @javax.annotation.Nullable - public Boolean getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable Boolean status) { - this.status = status; - } - - - public BaseResponseFunctionDataTypes data(@javax.annotation.Nullable FunctionDataTypes data) { - this.data = data; - return this; - } - - /** - * Response data - * @return data - */ - @javax.annotation.Nullable - public FunctionDataTypes getData() { - return data; - } - - public void setData(@javax.annotation.Nullable FunctionDataTypes data) { - this.data = data; - } - - - public BaseResponseFunctionDataTypes message(@javax.annotation.Nullable String message) { - this.message = message; - return this; - } - - /** - * Response message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; - } - - - public BaseResponseFunctionDataTypes errors(@javax.annotation.Nullable List errors) { - this.errors = errors; - return this; - } - - public BaseResponseFunctionDataTypes addErrorsItem(ErrorModel errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * List of errors - * @return errors - */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - public void setErrors(@javax.annotation.Nullable List errors) { - this.errors = errors; - } - - - public BaseResponseFunctionDataTypes meta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - return this; - } - - /** - * Metadata - * @return meta - */ - @javax.annotation.Nullable - public MetaModel getMeta() { - return meta; - } - - public void setMeta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - } - - /** - * 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 BaseResponseFunctionDataTypes instance itself - */ - public BaseResponseFunctionDataTypes 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; - } - BaseResponseFunctionDataTypes baseResponseFunctionDataTypes = (BaseResponseFunctionDataTypes) o; - return Objects.equals(this.status, baseResponseFunctionDataTypes.status) && - Objects.equals(this.data, baseResponseFunctionDataTypes.data) && - Objects.equals(this.message, baseResponseFunctionDataTypes.message) && - Objects.equals(this.errors, baseResponseFunctionDataTypes.errors) && - Objects.equals(this.meta, baseResponseFunctionDataTypes.meta)&& - Objects.equals(this.additionalProperties, baseResponseFunctionDataTypes.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(status, data, message, errors, meta, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseResponseFunctionDataTypes {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append(" meta: ").append(toIndentedString(meta)).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", "data", "message", "errors", "meta")); - - // 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 BaseResponseFunctionDataTypes - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BaseResponseFunctionDataTypes.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 BaseResponseFunctionDataTypes is not found in the empty JSON string", BaseResponseFunctionDataTypes.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - FunctionDataTypes.validateJsonElement(jsonObj.get("data")); - } - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !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("errors") != null && !jsonObj.get("errors").isJsonNull()) { - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - if (jsonArrayerrors != null) { - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - // validate the optional field `errors` (array) - for (int i = 0; i < jsonArrayerrors.size(); i++) { - ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); - }; - } - } - // validate the optional field `meta` - if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { - MetaModel.validateJsonElement(jsonObj.get("meta")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BaseResponseFunctionDataTypes.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseFunctionDataTypes' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseFunctionDataTypes.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BaseResponseFunctionDataTypes 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 BaseResponseFunctionDataTypes read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - BaseResponseFunctionDataTypes 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 BaseResponseFunctionDataTypes given an JSON string - * - * @param jsonString JSON string - * @return An instance of BaseResponseFunctionDataTypes - * @throws IOException if the JSON string is invalid with respect to BaseResponseFunctionDataTypes - */ - public static BaseResponseFunctionDataTypes fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseFunctionDataTypes.class); - } - - /** - * Convert an instance of BaseResponseFunctionDataTypes to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/BaseResponseFunctionDataTypesList.java b/src/main/java/ai/reveng/model/BaseResponseFunctionDataTypesList.java deleted file mode 100644 index 3e610c26..00000000 --- a/src/main/java/ai/reveng/model/BaseResponseFunctionDataTypesList.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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.ErrorModel; -import ai.reveng.model.FunctionDataTypesList; -import ai.reveng.model.MetaModel; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * BaseResponseFunctionDataTypesList - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseFunctionDataTypesList { - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private Boolean status = true; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - @javax.annotation.Nullable - private FunctionDataTypesList data; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; - - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - @javax.annotation.Nullable - private List errors; - - public static final String SERIALIZED_NAME_META = "meta"; - @SerializedName(SERIALIZED_NAME_META) - @javax.annotation.Nullable - private MetaModel meta; - - public BaseResponseFunctionDataTypesList() { - } - - public BaseResponseFunctionDataTypesList status(@javax.annotation.Nullable Boolean status) { - this.status = status; - return this; - } - - /** - * Response status on whether the request succeeded - * @return status - */ - @javax.annotation.Nullable - public Boolean getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable Boolean status) { - this.status = status; - } - - - public BaseResponseFunctionDataTypesList data(@javax.annotation.Nullable FunctionDataTypesList data) { - this.data = data; - return this; - } - - /** - * Response data - * @return data - */ - @javax.annotation.Nullable - public FunctionDataTypesList getData() { - return data; - } - - public void setData(@javax.annotation.Nullable FunctionDataTypesList data) { - this.data = data; - } - - - public BaseResponseFunctionDataTypesList message(@javax.annotation.Nullable String message) { - this.message = message; - return this; - } - - /** - * Response message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; - } - - - public BaseResponseFunctionDataTypesList errors(@javax.annotation.Nullable List errors) { - this.errors = errors; - return this; - } - - public BaseResponseFunctionDataTypesList addErrorsItem(ErrorModel errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * List of errors - * @return errors - */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - public void setErrors(@javax.annotation.Nullable List errors) { - this.errors = errors; - } - - - public BaseResponseFunctionDataTypesList meta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - return this; - } - - /** - * Metadata - * @return meta - */ - @javax.annotation.Nullable - public MetaModel getMeta() { - return meta; - } - - public void setMeta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - } - - /** - * 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 BaseResponseFunctionDataTypesList instance itself - */ - public BaseResponseFunctionDataTypesList 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; - } - BaseResponseFunctionDataTypesList baseResponseFunctionDataTypesList = (BaseResponseFunctionDataTypesList) o; - return Objects.equals(this.status, baseResponseFunctionDataTypesList.status) && - Objects.equals(this.data, baseResponseFunctionDataTypesList.data) && - Objects.equals(this.message, baseResponseFunctionDataTypesList.message) && - Objects.equals(this.errors, baseResponseFunctionDataTypesList.errors) && - Objects.equals(this.meta, baseResponseFunctionDataTypesList.meta)&& - Objects.equals(this.additionalProperties, baseResponseFunctionDataTypesList.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(status, data, message, errors, meta, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseResponseFunctionDataTypesList {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append(" meta: ").append(toIndentedString(meta)).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", "data", "message", "errors", "meta")); - - // 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 BaseResponseFunctionDataTypesList - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BaseResponseFunctionDataTypesList.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 BaseResponseFunctionDataTypesList is not found in the empty JSON string", BaseResponseFunctionDataTypesList.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - FunctionDataTypesList.validateJsonElement(jsonObj.get("data")); - } - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !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("errors") != null && !jsonObj.get("errors").isJsonNull()) { - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - if (jsonArrayerrors != null) { - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - // validate the optional field `errors` (array) - for (int i = 0; i < jsonArrayerrors.size(); i++) { - ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); - }; - } - } - // validate the optional field `meta` - if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { - MetaModel.validateJsonElement(jsonObj.get("meta")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BaseResponseFunctionDataTypesList.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseFunctionDataTypesList' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseFunctionDataTypesList.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BaseResponseFunctionDataTypesList 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 BaseResponseFunctionDataTypesList read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - BaseResponseFunctionDataTypesList 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 BaseResponseFunctionDataTypesList given an JSON string - * - * @param jsonString JSON string - * @return An instance of BaseResponseFunctionDataTypesList - * @throws IOException if the JSON string is invalid with respect to BaseResponseFunctionDataTypesList - */ - public static BaseResponseFunctionDataTypesList fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseFunctionDataTypesList.class); - } - - /** - * Convert an instance of BaseResponseFunctionDataTypesList to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/BaseResponseGenerateFunctionDataTypes.java b/src/main/java/ai/reveng/model/BaseResponseGenerateFunctionDataTypes.java deleted file mode 100644 index 256b89e9..00000000 --- a/src/main/java/ai/reveng/model/BaseResponseGenerateFunctionDataTypes.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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.ErrorModel; -import ai.reveng.model.GenerateFunctionDataTypes; -import ai.reveng.model.MetaModel; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * BaseResponseGenerateFunctionDataTypes - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseGenerateFunctionDataTypes { - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private Boolean status = true; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - @javax.annotation.Nullable - private GenerateFunctionDataTypes data; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; - - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - @javax.annotation.Nullable - private List errors; - - public static final String SERIALIZED_NAME_META = "meta"; - @SerializedName(SERIALIZED_NAME_META) - @javax.annotation.Nullable - private MetaModel meta; - - public BaseResponseGenerateFunctionDataTypes() { - } - - public BaseResponseGenerateFunctionDataTypes status(@javax.annotation.Nullable Boolean status) { - this.status = status; - return this; - } - - /** - * Response status on whether the request succeeded - * @return status - */ - @javax.annotation.Nullable - public Boolean getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable Boolean status) { - this.status = status; - } - - - public BaseResponseGenerateFunctionDataTypes data(@javax.annotation.Nullable GenerateFunctionDataTypes data) { - this.data = data; - return this; - } - - /** - * Response data - * @return data - */ - @javax.annotation.Nullable - public GenerateFunctionDataTypes getData() { - return data; - } - - public void setData(@javax.annotation.Nullable GenerateFunctionDataTypes data) { - this.data = data; - } - - - public BaseResponseGenerateFunctionDataTypes message(@javax.annotation.Nullable String message) { - this.message = message; - return this; - } - - /** - * Response message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; - } - - - public BaseResponseGenerateFunctionDataTypes errors(@javax.annotation.Nullable List errors) { - this.errors = errors; - return this; - } - - public BaseResponseGenerateFunctionDataTypes addErrorsItem(ErrorModel errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * List of errors - * @return errors - */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - public void setErrors(@javax.annotation.Nullable List errors) { - this.errors = errors; - } - - - public BaseResponseGenerateFunctionDataTypes meta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - return this; - } - - /** - * Metadata - * @return meta - */ - @javax.annotation.Nullable - public MetaModel getMeta() { - return meta; - } - - public void setMeta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - } - - /** - * 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 BaseResponseGenerateFunctionDataTypes instance itself - */ - public BaseResponseGenerateFunctionDataTypes 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; - } - BaseResponseGenerateFunctionDataTypes baseResponseGenerateFunctionDataTypes = (BaseResponseGenerateFunctionDataTypes) o; - return Objects.equals(this.status, baseResponseGenerateFunctionDataTypes.status) && - Objects.equals(this.data, baseResponseGenerateFunctionDataTypes.data) && - Objects.equals(this.message, baseResponseGenerateFunctionDataTypes.message) && - Objects.equals(this.errors, baseResponseGenerateFunctionDataTypes.errors) && - Objects.equals(this.meta, baseResponseGenerateFunctionDataTypes.meta)&& - Objects.equals(this.additionalProperties, baseResponseGenerateFunctionDataTypes.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(status, data, message, errors, meta, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseResponseGenerateFunctionDataTypes {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append(" meta: ").append(toIndentedString(meta)).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", "data", "message", "errors", "meta")); - - // 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 BaseResponseGenerateFunctionDataTypes - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BaseResponseGenerateFunctionDataTypes.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 BaseResponseGenerateFunctionDataTypes is not found in the empty JSON string", BaseResponseGenerateFunctionDataTypes.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - GenerateFunctionDataTypes.validateJsonElement(jsonObj.get("data")); - } - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !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("errors") != null && !jsonObj.get("errors").isJsonNull()) { - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - if (jsonArrayerrors != null) { - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - // validate the optional field `errors` (array) - for (int i = 0; i < jsonArrayerrors.size(); i++) { - ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); - }; - } - } - // validate the optional field `meta` - if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { - MetaModel.validateJsonElement(jsonObj.get("meta")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BaseResponseGenerateFunctionDataTypes.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseGenerateFunctionDataTypes' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseGenerateFunctionDataTypes.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BaseResponseGenerateFunctionDataTypes 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 BaseResponseGenerateFunctionDataTypes read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - BaseResponseGenerateFunctionDataTypes 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 BaseResponseGenerateFunctionDataTypes given an JSON string - * - * @param jsonString JSON string - * @return An instance of BaseResponseGenerateFunctionDataTypes - * @throws IOException if the JSON string is invalid with respect to BaseResponseGenerateFunctionDataTypes - */ - public static BaseResponseGenerateFunctionDataTypes fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseGenerateFunctionDataTypes.class); - } - - /** - * Convert an instance of BaseResponseGenerateFunctionDataTypes to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/BaseResponseGenerationStatusList.java b/src/main/java/ai/reveng/model/BaseResponseGenerationStatusList.java deleted file mode 100644 index 20afcb53..00000000 --- a/src/main/java/ai/reveng/model/BaseResponseGenerationStatusList.java +++ /dev/null @@ -1,433 +0,0 @@ -/* - * 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.ErrorModel; -import ai.reveng.model.GenerationStatusList; -import ai.reveng.model.MetaModel; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * BaseResponseGenerationStatusList - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BaseResponseGenerationStatusList { - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private Boolean status = true; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - @javax.annotation.Nullable - private GenerationStatusList data; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; - - public static final String SERIALIZED_NAME_ERRORS = "errors"; - @SerializedName(SERIALIZED_NAME_ERRORS) - @javax.annotation.Nullable - private List errors; - - public static final String SERIALIZED_NAME_META = "meta"; - @SerializedName(SERIALIZED_NAME_META) - @javax.annotation.Nullable - private MetaModel meta; - - public BaseResponseGenerationStatusList() { - } - - public BaseResponseGenerationStatusList status(@javax.annotation.Nullable Boolean status) { - this.status = status; - return this; - } - - /** - * Response status on whether the request succeeded - * @return status - */ - @javax.annotation.Nullable - public Boolean getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable Boolean status) { - this.status = status; - } - - - public BaseResponseGenerationStatusList data(@javax.annotation.Nullable GenerationStatusList data) { - this.data = data; - return this; - } - - /** - * Response data - * @return data - */ - @javax.annotation.Nullable - public GenerationStatusList getData() { - return data; - } - - public void setData(@javax.annotation.Nullable GenerationStatusList data) { - this.data = data; - } - - - public BaseResponseGenerationStatusList message(@javax.annotation.Nullable String message) { - this.message = message; - return this; - } - - /** - * Response message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; - } - - - public BaseResponseGenerationStatusList errors(@javax.annotation.Nullable List errors) { - this.errors = errors; - return this; - } - - public BaseResponseGenerationStatusList addErrorsItem(ErrorModel errorsItem) { - if (this.errors == null) { - this.errors = new ArrayList<>(); - } - this.errors.add(errorsItem); - return this; - } - - /** - * List of errors - * @return errors - */ - @javax.annotation.Nullable - public List getErrors() { - return errors; - } - - public void setErrors(@javax.annotation.Nullable List errors) { - this.errors = errors; - } - - - public BaseResponseGenerationStatusList meta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - return this; - } - - /** - * Metadata - * @return meta - */ - @javax.annotation.Nullable - public MetaModel getMeta() { - return meta; - } - - public void setMeta(@javax.annotation.Nullable MetaModel meta) { - this.meta = meta; - } - - /** - * 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 BaseResponseGenerationStatusList instance itself - */ - public BaseResponseGenerationStatusList 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; - } - BaseResponseGenerationStatusList baseResponseGenerationStatusList = (BaseResponseGenerationStatusList) o; - return Objects.equals(this.status, baseResponseGenerationStatusList.status) && - Objects.equals(this.data, baseResponseGenerationStatusList.data) && - Objects.equals(this.message, baseResponseGenerationStatusList.message) && - Objects.equals(this.errors, baseResponseGenerationStatusList.errors) && - Objects.equals(this.meta, baseResponseGenerationStatusList.meta)&& - Objects.equals(this.additionalProperties, baseResponseGenerationStatusList.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(status, data, message, errors, meta, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class BaseResponseGenerationStatusList {\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); - sb.append(" meta: ").append(toIndentedString(meta)).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", "data", "message", "errors", "meta")); - - // 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 BaseResponseGenerationStatusList - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!BaseResponseGenerationStatusList.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 BaseResponseGenerationStatusList is not found in the empty JSON string", BaseResponseGenerationStatusList.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `data` - if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { - GenerationStatusList.validateJsonElement(jsonObj.get("data")); - } - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !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("errors") != null && !jsonObj.get("errors").isJsonNull()) { - JsonArray jsonArrayerrors = jsonObj.getAsJsonArray("errors"); - if (jsonArrayerrors != null) { - // ensure the json data is an array - if (!jsonObj.get("errors").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `errors` to be an array in the JSON string but got `%s`", jsonObj.get("errors").toString())); - } - - // validate the optional field `errors` (array) - for (int i = 0; i < jsonArrayerrors.size(); i++) { - ErrorModel.validateJsonElement(jsonArrayerrors.get(i)); - }; - } - } - // validate the optional field `meta` - if (jsonObj.get("meta") != null && !jsonObj.get("meta").isJsonNull()) { - MetaModel.validateJsonElement(jsonObj.get("meta")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!BaseResponseGenerationStatusList.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BaseResponseGenerationStatusList' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BaseResponseGenerationStatusList.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, BaseResponseGenerationStatusList 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 BaseResponseGenerationStatusList read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - BaseResponseGenerationStatusList 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 BaseResponseGenerationStatusList given an JSON string - * - * @param jsonString JSON string - * @return An instance of BaseResponseGenerationStatusList - * @throws IOException if the JSON string is invalid with respect to BaseResponseGenerationStatusList - */ - public static BaseResponseGenerationStatusList fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BaseResponseGenerationStatusList.class); - } - - /** - * Convert an instance of BaseResponseGenerationStatusList to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/BatchFunctionSignatureEntry.java b/src/main/java/ai/reveng/model/BatchFunctionSignatureEntry.java new file mode 100644 index 00000000..0b26b971 --- /dev/null +++ b/src/main/java/ai/reveng/model/BatchFunctionSignatureEntry.java @@ -0,0 +1,530 @@ +/* + * 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.SignatureParameterEntry; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * BatchFunctionSignatureEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BatchFunctionSignatureEntry { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + public static final String SERIALIZED_NAME_CALLING_CONVENTION = "calling_convention"; + @SerializedName(SERIALIZED_NAME_CALLING_CONVENTION) + @javax.annotation.Nullable + private String callingConvention; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nonnull + private Long functionId; + + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; + + public static final String SERIALIZED_NAME_HAS_SIGNATURE = "has_signature"; + @SerializedName(SERIALIZED_NAME_HAS_SIGNATURE) + @javax.annotation.Nonnull + private Boolean hasSignature; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters; + + public static final String SERIALIZED_NAME_RETURN_DATA_TYPE_ID = "return_data_type_id"; + @SerializedName(SERIALIZED_NAME_RETURN_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long returnDataTypeId; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this signature came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nullable + private SourceTypeEnum sourceType; + + public BatchFunctionSignatureEntry() { + } + + public BatchFunctionSignatureEntry analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * The analysis this signature belongs to. Its data_type_ids resolve against this analysis only. + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public BatchFunctionSignatureEntry callingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + return this; + } + + /** + * Calling convention, when the producer reported one. + * @return callingConvention + */ + @javax.annotation.Nullable + public String getCallingConvention() { + return callingConvention; + } + + public void setCallingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + } + + + public BatchFunctionSignatureEntry createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this signature was extracted. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BatchFunctionSignatureEntry functionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + return this; + } + + /** + * Get functionId + * @return functionId + */ + @javax.annotation.Nonnull + public Long getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + } + + + public BatchFunctionSignatureEntry functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Current name of the function. + * @return functionName + */ + @javax.annotation.Nonnull + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + } + + + public BatchFunctionSignatureEntry hasSignature(@javax.annotation.Nonnull Boolean hasSignature) { + this.hasSignature = hasSignature; + return this; + } + + /** + * Whether a signature was extracted for this function. False is a normal result: no signature is recorded unless data type extraction ran for the analysis, and thunks and external functions are skipped when it does. + * @return hasSignature + */ + @javax.annotation.Nonnull + public Boolean getHasSignature() { + return hasSignature; + } + + public void setHasSignature(@javax.annotation.Nonnull Boolean hasSignature) { + this.hasSignature = hasSignature; + } + + + public BatchFunctionSignatureEntry parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public BatchFunctionSignatureEntry addParametersItem(SignatureParameterEntry parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Parameters in argument order. Empty with has_signature true means the function is known to take no arguments. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public BatchFunctionSignatureEntry returnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + return this; + } + + /** + * Return type, resolvable against the analysis data types list. Absent for an unresolved return type. + * @return returnDataTypeId + */ + @javax.annotation.Nullable + public Long getReturnDataTypeId() { + return returnDataTypeId; + } + + public void setReturnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + } + + + public BatchFunctionSignatureEntry sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this signature was copied from, when it was transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public BatchFunctionSignatureEntry sourceType(@javax.annotation.Nullable SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this signature came from. + * @return sourceType + */ + @javax.annotation.Nullable + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nullable SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BatchFunctionSignatureEntry batchFunctionSignatureEntry = (BatchFunctionSignatureEntry) o; + return Objects.equals(this.analysisId, batchFunctionSignatureEntry.analysisId) && + Objects.equals(this.callingConvention, batchFunctionSignatureEntry.callingConvention) && + Objects.equals(this.createdAt, batchFunctionSignatureEntry.createdAt) && + Objects.equals(this.functionId, batchFunctionSignatureEntry.functionId) && + Objects.equals(this.functionName, batchFunctionSignatureEntry.functionName) && + Objects.equals(this.hasSignature, batchFunctionSignatureEntry.hasSignature) && + Objects.equals(this.parameters, batchFunctionSignatureEntry.parameters) && + Objects.equals(this.returnDataTypeId, batchFunctionSignatureEntry.returnDataTypeId) && + Objects.equals(this.sourceFunctionId, batchFunctionSignatureEntry.sourceFunctionId) && + Objects.equals(this.sourceType, batchFunctionSignatureEntry.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(analysisId, callingConvention, createdAt, functionId, functionName, hasSignature, parameters, returnDataTypeId, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BatchFunctionSignatureEntry {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" callingConvention: ").append(toIndentedString(callingConvention)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); + sb.append(" hasSignature: ").append(toIndentedString(hasSignature)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" returnDataTypeId: ").append(toIndentedString(returnDataTypeId)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analysis_id", "calling_convention", "created_at", "function_id", "function_name", "has_signature", "parameters", "return_data_type_id", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "function_id", "function_name", "has_signature", "parameters")); + } + + /** + * 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 BatchFunctionSignatureEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BatchFunctionSignatureEntry.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 BatchFunctionSignatureEntry is not found in the empty JSON string", BatchFunctionSignatureEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BatchFunctionSignatureEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BatchFunctionSignatureEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BatchFunctionSignatureEntry.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("calling_convention") != null && !jsonObj.get("calling_convention").isJsonNull()) && !jsonObj.get("calling_convention").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `calling_convention` to be a primitive type in the JSON string but got `%s`", jsonObj.get("calling_convention").toString())); + } + if (!jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + SignatureParameterEntry.validateJsonElement(jsonArrayparameters.get(i)); + } + } + if ((jsonObj.get("source_type") != null && !jsonObj.get("source_type").isJsonNull()) && !jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the optional field `source_type` + if (jsonObj.get("source_type") != null && !jsonObj.get("source_type").isJsonNull()) { + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BatchFunctionSignatureEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BatchFunctionSignatureEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BatchFunctionSignatureEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BatchFunctionSignatureEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BatchFunctionSignatureEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BatchFunctionSignatureEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of BatchFunctionSignatureEntry + * @throws IOException if the JSON string is invalid with respect to BatchFunctionSignatureEntry + */ + public static BatchFunctionSignatureEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BatchFunctionSignatureEntry.class); + } + + /** + * Convert an instance of BatchFunctionSignatureEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BitfieldDataType.java b/src/main/java/ai/reveng/model/BitfieldDataType.java new file mode 100644 index 00000000..ef9fdb5a --- /dev/null +++ b/src/main/java/ai/reveng/model/BitfieldDataType.java @@ -0,0 +1,540 @@ +/* + * 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; + +/** + * BitfieldDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class BitfieldDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + BITFIELD("BITFIELD"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public BitfieldDataType() { + } + + public BitfieldDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public BitfieldDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public BitfieldDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public BitfieldDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public BitfieldDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public BitfieldDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public BitfieldDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public BitfieldDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public BitfieldDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BitfieldDataType bitfieldDataType = (BitfieldDataType) o; + return Objects.equals(this.createdAt, bitfieldDataType.createdAt) && + Objects.equals(this.dataTypeId, bitfieldDataType.dataTypeId) && + Objects.equals(this.hasDefinition, bitfieldDataType.hasDefinition) && + Objects.equals(this.kind, bitfieldDataType.kind) && + Objects.equals(this.name, bitfieldDataType.name) && + Objects.equals(this.namespace, bitfieldDataType.namespace) && + Objects.equals(this.size, bitfieldDataType.size) && + Objects.equals(this.sourceFunctionId, bitfieldDataType.sourceFunctionId) && + Objects.equals(this.sourceType, bitfieldDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BitfieldDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BitfieldDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BitfieldDataType.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 BitfieldDataType is not found in the empty JSON string", BitfieldDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BitfieldDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BitfieldDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BitfieldDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BitfieldDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BitfieldDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BitfieldDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BitfieldDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BitfieldDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BitfieldDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of BitfieldDataType + * @throws IOException if the JSON string is invalid with respect to BitfieldDataType + */ + public static BitfieldDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BitfieldDataType.class); + } + + /** + * Convert an instance of BitfieldDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ConfigResponse.java b/src/main/java/ai/reveng/model/ConfigResponse.java index 7448c377..89933bac 100644 --- a/src/main/java/ai/reveng/model/ConfigResponse.java +++ b/src/main/java/ai/reveng/model/ConfigResponse.java @@ -59,7 +59,7 @@ public class ConfigResponse { public static final String SERIALIZED_NAME_MAX_FILE_SIZE_BYTES = "max_file_size_bytes"; @SerializedName(SERIALIZED_NAME_MAX_FILE_SIZE_BYTES) @javax.annotation.Nonnull - private Integer maxFileSizeBytes; + private Long maxFileSizeBytes; public static final String SERIALIZED_NAME_AI_DECOMPILER_UNSUPPORTED_LANGUAGES = "ai_decompiler_unsupported_languages"; @SerializedName(SERIALIZED_NAME_AI_DECOMPILER_UNSUPPORTED_LANGUAGES) @@ -93,7 +93,7 @@ public void setDashboardUrl(@javax.annotation.Nullable String dashboardUrl) { } - public ConfigResponse maxFileSizeBytes(@javax.annotation.Nonnull Integer maxFileSizeBytes) { + public ConfigResponse maxFileSizeBytes(@javax.annotation.Nonnull Long maxFileSizeBytes) { this.maxFileSizeBytes = maxFileSizeBytes; return this; } @@ -103,11 +103,11 @@ public ConfigResponse maxFileSizeBytes(@javax.annotation.Nonnull Integer maxFile * @return maxFileSizeBytes */ @javax.annotation.Nonnull - public Integer getMaxFileSizeBytes() { + public Long getMaxFileSizeBytes() { return maxFileSizeBytes; } - public void setMaxFileSizeBytes(@javax.annotation.Nonnull Integer maxFileSizeBytes) { + public void setMaxFileSizeBytes(@javax.annotation.Nonnull Long maxFileSizeBytes) { this.maxFileSizeBytes = maxFileSizeBytes; } diff --git a/src/main/java/ai/reveng/model/BatchUpdateDataTypesInputBody.java b/src/main/java/ai/reveng/model/CopyFunctionSignaturesInputBody.java similarity index 57% rename from src/main/java/ai/reveng/model/BatchUpdateDataTypesInputBody.java rename to src/main/java/ai/reveng/model/CopyFunctionSignaturesInputBody.java index e49f1f26..ef89ed68 100644 --- a/src/main/java/ai/reveng/model/BatchUpdateDataTypesInputBody.java +++ b/src/main/java/ai/reveng/model/CopyFunctionSignaturesInputBody.java @@ -13,7 +13,7 @@ package ai.reveng.model; import java.util.Objects; -import ai.reveng.model.BatchUpdateDataTypesItem; +import ai.reveng.model.CopySignatureItem; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -48,42 +48,42 @@ import ai.reveng.invoker.JSON; /** - * BatchUpdateDataTypesInputBody + * CopyFunctionSignaturesInputBody */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BatchUpdateDataTypesInputBody { - public static final String SERIALIZED_NAME_FUNCTIONS = "functions"; - @SerializedName(SERIALIZED_NAME_FUNCTIONS) +public class CopyFunctionSignaturesInputBody { + public static final String SERIALIZED_NAME_COPIES = "copies"; + @SerializedName(SERIALIZED_NAME_COPIES) @javax.annotation.Nullable - private List functions; + private List copies; - public BatchUpdateDataTypesInputBody() { + public CopyFunctionSignaturesInputBody() { } - public BatchUpdateDataTypesInputBody functions(@javax.annotation.Nullable List functions) { - this.functions = functions; + public CopyFunctionSignaturesInputBody copies(@javax.annotation.Nullable List copies) { + this.copies = copies; return this; } - public BatchUpdateDataTypesInputBody addFunctionsItem(BatchUpdateDataTypesItem functionsItem) { - if (this.functions == null) { - this.functions = new ArrayList<>(); + public CopyFunctionSignaturesInputBody addCopiesItem(CopySignatureItem copiesItem) { + if (this.copies == null) { + this.copies = new ArrayList<>(); } - this.functions.add(functionsItem); + this.copies.add(copiesItem); return this; } /** - * List of functions to update. All function IDs must belong to the analysis in the URL. - * @return functions + * Signatures to copy. No target may repeat, and no pair may name the same function twice. + * @return copies */ @javax.annotation.Nullable - public List getFunctions() { - return functions; + public List getCopies() { + return copies; } - public void setFunctions(@javax.annotation.Nullable List functions) { - this.functions = functions; + public void setCopies(@javax.annotation.Nullable List copies) { + this.copies = copies; } @@ -96,20 +96,20 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BatchUpdateDataTypesInputBody batchUpdateDataTypesInputBody = (BatchUpdateDataTypesInputBody) o; - return Objects.equals(this.functions, batchUpdateDataTypesInputBody.functions); + CopyFunctionSignaturesInputBody copyFunctionSignaturesInputBody = (CopyFunctionSignaturesInputBody) o; + return Objects.equals(this.copies, copyFunctionSignaturesInputBody.copies); } @Override public int hashCode() { - return Objects.hash(functions); + return Objects.hash(copies); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BatchUpdateDataTypesInputBody {\n"); - sb.append(" functions: ").append(toIndentedString(functions)).append("\n"); + sb.append("class CopyFunctionSignaturesInputBody {\n"); + sb.append(" copies: ").append(toIndentedString(copies)).append("\n"); sb.append("}"); return sb.toString(); } @@ -128,48 +128,48 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("functions")); + openapiFields = new HashSet(Arrays.asList("copies")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("functions")); + openapiRequiredFields = new HashSet(Arrays.asList("copies")); } /** * 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 BatchUpdateDataTypesInputBody + * @throws IOException if the JSON Element is invalid with respect to CopyFunctionSignaturesInputBody */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!BatchUpdateDataTypesInputBody.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 BatchUpdateDataTypesInputBody is not found in the empty JSON string", BatchUpdateDataTypesInputBody.openapiRequiredFields.toString())); + if (!CopyFunctionSignaturesInputBody.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 CopyFunctionSignaturesInputBody is not found in the empty JSON string", CopyFunctionSignaturesInputBody.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!BatchUpdateDataTypesInputBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BatchUpdateDataTypesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!CopyFunctionSignaturesInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CopyFunctionSignaturesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BatchUpdateDataTypesInputBody.openapiRequiredFields) { + for (String requiredField : CopyFunctionSignaturesInputBody.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("functions") != null && !jsonObj.get("functions").isJsonNull()) { - if (!jsonObj.get("functions").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `functions` to be an array in the JSON string but got `%s`", jsonObj.get("functions").toString())); + if (jsonObj.get("copies") != null && !jsonObj.get("copies").isJsonNull()) { + if (!jsonObj.get("copies").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `copies` to be an array in the JSON string but got `%s`", jsonObj.get("copies").toString())); } - JsonArray jsonArrayfunctions = jsonObj.getAsJsonArray("functions"); - // validate the required field `functions` (array) - for (int i = 0; i < jsonArrayfunctions.size(); i++) { - BatchUpdateDataTypesItem.validateJsonElement(jsonArrayfunctions.get(i)); + JsonArray jsonArraycopies = jsonObj.getAsJsonArray("copies"); + // validate the required field `copies` (array) + for (int i = 0; i < jsonArraycopies.size(); i++) { + CopySignatureItem.validateJsonElement(jsonArraycopies.get(i)); } } } @@ -178,22 +178,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchUpdateDataTypesInputBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchUpdateDataTypesInputBody' and its subtypes + if (!CopyFunctionSignaturesInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CopyFunctionSignaturesInputBody' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchUpdateDataTypesInputBody.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CopyFunctionSignaturesInputBody.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, BatchUpdateDataTypesInputBody value) throws IOException { + public void write(JsonWriter out, CopyFunctionSignaturesInputBody value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public BatchUpdateDataTypesInputBody read(JsonReader in) throws IOException { + public CopyFunctionSignaturesInputBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -204,18 +204,18 @@ public BatchUpdateDataTypesInputBody read(JsonReader in) throws IOException { } /** - * Create an instance of BatchUpdateDataTypesInputBody given an JSON string + * Create an instance of CopyFunctionSignaturesInputBody given an JSON string * * @param jsonString JSON string - * @return An instance of BatchUpdateDataTypesInputBody - * @throws IOException if the JSON string is invalid with respect to BatchUpdateDataTypesInputBody + * @return An instance of CopyFunctionSignaturesInputBody + * @throws IOException if the JSON string is invalid with respect to CopyFunctionSignaturesInputBody */ - public static BatchUpdateDataTypesInputBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BatchUpdateDataTypesInputBody.class); + public static CopyFunctionSignaturesInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CopyFunctionSignaturesInputBody.class); } /** - * Convert an instance of BatchUpdateDataTypesInputBody to an JSON string + * Convert an instance of CopyFunctionSignaturesInputBody to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/CopyFunctionSignaturesOutputBody.java b/src/main/java/ai/reveng/model/CopyFunctionSignaturesOutputBody.java new file mode 100644 index 00000000..a218136d --- /dev/null +++ b/src/main/java/ai/reveng/model/CopyFunctionSignaturesOutputBody.java @@ -0,0 +1,271 @@ +/* + * 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.DataTypeEntry; +import ai.reveng.model.FunctionSignatureEntry; +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; + +/** + * CopyFunctionSignaturesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CopyFunctionSignaturesOutputBody { + public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; + @SerializedName(SERIALIZED_NAME_DATA_TYPES) + @javax.annotation.Nullable + private List dataTypes; + + public static final String SERIALIZED_NAME_SIGNATURES = "signatures"; + @SerializedName(SERIALIZED_NAME_SIGNATURES) + @javax.annotation.Nullable + private List signatures; + + public CopyFunctionSignaturesOutputBody() { + } + + public CopyFunctionSignaturesOutputBody dataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + public CopyFunctionSignaturesOutputBody addDataTypesItem(DataTypeEntry dataTypesItem) { + if (this.dataTypes == null) { + this.dataTypes = new ArrayList<>(); + } + this.dataTypes.add(dataTypesItem); + return this; + } + + /** + * The data types this analysis gained or had replaced, ordered by data_type_id. Empty when every type the copied signatures need was already stored unchanged. + * @return dataTypes + */ + @javax.annotation.Nullable + public List getDataTypes() { + return dataTypes; + } + + public void setDataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + } + + + public CopyFunctionSignaturesOutputBody signatures(@javax.annotation.Nullable List signatures) { + this.signatures = signatures; + return this; + } + + public CopyFunctionSignaturesOutputBody addSignaturesItem(FunctionSignatureEntry signaturesItem) { + if (this.signatures == null) { + this.signatures = new ArrayList<>(); + } + this.signatures.add(signaturesItem); + return this; + } + + /** + * The stored signatures of the target functions, in request order. + * @return signatures + */ + @javax.annotation.Nullable + public List getSignatures() { + return signatures; + } + + public void setSignatures(@javax.annotation.Nullable List signatures) { + this.signatures = signatures; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CopyFunctionSignaturesOutputBody copyFunctionSignaturesOutputBody = (CopyFunctionSignaturesOutputBody) o; + return Objects.equals(this.dataTypes, copyFunctionSignaturesOutputBody.dataTypes) && + Objects.equals(this.signatures, copyFunctionSignaturesOutputBody.signatures); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypes, signatures); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CopyFunctionSignaturesOutputBody {\n"); + sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); + sb.append(" signatures: ").append(toIndentedString(signatures)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_types", "signatures")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_types", "signatures")); + } + + /** + * 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 CopyFunctionSignaturesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CopyFunctionSignaturesOutputBody.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 CopyFunctionSignaturesOutputBody is not found in the empty JSON string", CopyFunctionSignaturesOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CopyFunctionSignaturesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CopyFunctionSignaturesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CopyFunctionSignaturesOutputBody.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("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { + if (!jsonObj.get("data_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data_types` to be an array in the JSON string but got `%s`", jsonObj.get("data_types").toString())); + } + JsonArray jsonArraydataTypes = jsonObj.getAsJsonArray("data_types"); + // validate the required field `data_types` (array) + for (int i = 0; i < jsonArraydataTypes.size(); i++) { + DataTypeEntry.validateJsonElement(jsonArraydataTypes.get(i)); + } + } + if (jsonObj.get("signatures") != null && !jsonObj.get("signatures").isJsonNull()) { + if (!jsonObj.get("signatures").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `signatures` to be an array in the JSON string but got `%s`", jsonObj.get("signatures").toString())); + } + JsonArray jsonArraysignatures = jsonObj.getAsJsonArray("signatures"); + // validate the required field `signatures` (array) + for (int i = 0; i < jsonArraysignatures.size(); i++) { + FunctionSignatureEntry.validateJsonElement(jsonArraysignatures.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CopyFunctionSignaturesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CopyFunctionSignaturesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CopyFunctionSignaturesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CopyFunctionSignaturesOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CopyFunctionSignaturesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CopyFunctionSignaturesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of CopyFunctionSignaturesOutputBody + * @throws IOException if the JSON string is invalid with respect to CopyFunctionSignaturesOutputBody + */ + public static CopyFunctionSignaturesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CopyFunctionSignaturesOutputBody.class); + } + + /** + * Convert an instance of CopyFunctionSignaturesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CopySignatureItem.java b/src/main/java/ai/reveng/model/CopySignatureItem.java new file mode 100644 index 00000000..9851463a --- /dev/null +++ b/src/main/java/ai/reveng/model/CopySignatureItem.java @@ -0,0 +1,233 @@ +/* + * 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; + +/** + * CopySignatureItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CopySignatureItem { + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nonnull + private Long sourceFunctionId; + + public static final String SERIALIZED_NAME_TARGET_FUNCTION_ID = "target_function_id"; + @SerializedName(SERIALIZED_NAME_TARGET_FUNCTION_ID) + @javax.annotation.Nonnull + private Long targetFunctionId; + + public CopySignatureItem() { + } + + public CopySignatureItem sourceFunctionId(@javax.annotation.Nonnull Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * Function to copy the signature from. May belong to another analysis the caller can read. + * minimum: 1 + * @return sourceFunctionId + */ + @javax.annotation.Nonnull + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nonnull Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public CopySignatureItem targetFunctionId(@javax.annotation.Nonnull Long targetFunctionId) { + this.targetFunctionId = targetFunctionId; + return this; + } + + /** + * Function to copy the signature to. Must belong to the analysis in the URL. + * minimum: 1 + * @return targetFunctionId + */ + @javax.annotation.Nonnull + public Long getTargetFunctionId() { + return targetFunctionId; + } + + public void setTargetFunctionId(@javax.annotation.Nonnull Long targetFunctionId) { + this.targetFunctionId = targetFunctionId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CopySignatureItem copySignatureItem = (CopySignatureItem) o; + return Objects.equals(this.sourceFunctionId, copySignatureItem.sourceFunctionId) && + Objects.equals(this.targetFunctionId, copySignatureItem.targetFunctionId); + } + + @Override + public int hashCode() { + return Objects.hash(sourceFunctionId, targetFunctionId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CopySignatureItem {\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" targetFunctionId: ").append(toIndentedString(targetFunctionId)).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("source_function_id", "target_function_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("source_function_id", "target_function_id")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CopySignatureItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CopySignatureItem.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 CopySignatureItem is not found in the empty JSON string", CopySignatureItem.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CopySignatureItem.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CopySignatureItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CopySignatureItem.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 (!CopySignatureItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CopySignatureItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CopySignatureItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CopySignatureItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CopySignatureItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CopySignatureItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of CopySignatureItem + * @throws IOException if the JSON string is invalid with respect to CopySignatureItem + */ + public static CopySignatureItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CopySignatureItem.class); + } + + /** + * Convert an instance of CopySignatureItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BatchUpdateDataTypesItem.java b/src/main/java/ai/reveng/model/CreateAnalysisDataTypesInputBody.java similarity index 57% rename from src/main/java/ai/reveng/model/BatchUpdateDataTypesItem.java rename to src/main/java/ai/reveng/model/CreateAnalysisDataTypesInputBody.java index 9a40e827..a10fa763 100644 --- a/src/main/java/ai/reveng/model/BatchUpdateDataTypesItem.java +++ b/src/main/java/ai/reveng/model/CreateAnalysisDataTypesInputBody.java @@ -13,13 +13,16 @@ package ai.reveng.model; import java.util.Objects; +import ai.reveng.model.CreateDataTypeEntry; 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; @@ -45,87 +48,45 @@ import ai.reveng.invoker.JSON; /** - * BatchUpdateDataTypesItem + * CreateAnalysisDataTypesInputBody */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BatchUpdateDataTypesItem { +public class CreateAnalysisDataTypesInputBody { public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; @SerializedName(SERIALIZED_NAME_DATA_TYPES) @javax.annotation.Nullable - private Object dataTypes = null; - - public static final String SERIALIZED_NAME_DATA_TYPES_VERSION = "data_types_version"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_VERSION) - @javax.annotation.Nonnull - private Long dataTypesVersion; + private List dataTypes; - public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; - @SerializedName(SERIALIZED_NAME_FUNCTION_ID) - @javax.annotation.Nonnull - private Long functionId; - - public BatchUpdateDataTypesItem() { + public CreateAnalysisDataTypesInputBody() { } - public BatchUpdateDataTypesItem dataTypes(@javax.annotation.Nullable Object dataTypes) { + public CreateAnalysisDataTypesInputBody dataTypes(@javax.annotation.Nullable List dataTypes) { this.dataTypes = dataTypes; return this; } + public CreateAnalysisDataTypesInputBody addDataTypesItem(CreateDataTypeEntry dataTypesItem) { + if (this.dataTypes == null) { + this.dataTypes = new ArrayList<>(); + } + this.dataTypes.add(dataTypesItem); + return this; + } + /** - * Get dataTypes + * The types to create. Each namespace, name and kind must be new to the analysis. * @return dataTypes */ @javax.annotation.Nullable - public Object getDataTypes() { + public List getDataTypes() { return dataTypes; } - public void setDataTypes(@javax.annotation.Nullable Object dataTypes) { + public void setDataTypes(@javax.annotation.Nullable List dataTypes) { this.dataTypes = dataTypes; } - public BatchUpdateDataTypesItem dataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - return this; - } - - /** - * Current stored version. Pass 0 on the first write. - * minimum: 0 - * @return dataTypesVersion - */ - @javax.annotation.Nonnull - public Long getDataTypesVersion() { - return dataTypesVersion; - } - - public void setDataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - } - - - public BatchUpdateDataTypesItem functionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - return this; - } - - /** - * Function ID - * minimum: 1 - * @return functionId - */ - @javax.annotation.Nonnull - public Long getFunctionId() { - return functionId; - } - - public void setFunctionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - } - - @Override public boolean equals(Object o) { @@ -135,24 +96,20 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BatchUpdateDataTypesItem batchUpdateDataTypesItem = (BatchUpdateDataTypesItem) o; - return Objects.equals(this.dataTypes, batchUpdateDataTypesItem.dataTypes) && - Objects.equals(this.dataTypesVersion, batchUpdateDataTypesItem.dataTypesVersion) && - Objects.equals(this.functionId, batchUpdateDataTypesItem.functionId); + CreateAnalysisDataTypesInputBody createAnalysisDataTypesInputBody = (CreateAnalysisDataTypesInputBody) o; + return Objects.equals(this.dataTypes, createAnalysisDataTypesInputBody.dataTypes); } @Override public int hashCode() { - return Objects.hash(dataTypes, dataTypesVersion, functionId); + return Objects.hash(dataTypes); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BatchUpdateDataTypesItem {\n"); + sb.append("class CreateAnalysisDataTypesInputBody {\n"); sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); - sb.append(" dataTypesVersion: ").append(toIndentedString(dataTypesVersion)).append("\n"); - sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); sb.append("}"); return sb.toString(); } @@ -171,62 +128,72 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("data_types", "data_types_version", "function_id")); + openapiFields = new HashSet(Arrays.asList("data_types")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("data_types", "data_types_version", "function_id")); + openapiRequiredFields = new HashSet(Arrays.asList("data_types")); } /** * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to BatchUpdateDataTypesItem + * @throws IOException if the JSON Element is invalid with respect to CreateAnalysisDataTypesInputBody */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!BatchUpdateDataTypesItem.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 BatchUpdateDataTypesItem is not found in the empty JSON string", BatchUpdateDataTypesItem.openapiRequiredFields.toString())); + if (!CreateAnalysisDataTypesInputBody.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 CreateAnalysisDataTypesInputBody is not found in the empty JSON string", CreateAnalysisDataTypesInputBody.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!BatchUpdateDataTypesItem.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BatchUpdateDataTypesItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!CreateAnalysisDataTypesInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateAnalysisDataTypesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BatchUpdateDataTypesItem.openapiRequiredFields) { + for (String requiredField : CreateAnalysisDataTypesInputBody.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("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { + if (!jsonObj.get("data_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data_types` to be an array in the JSON string but got `%s`", jsonObj.get("data_types").toString())); + } + JsonArray jsonArraydataTypes = jsonObj.getAsJsonArray("data_types"); + // validate the required field `data_types` (array) + for (int i = 0; i < jsonArraydataTypes.size(); i++) { + CreateDataTypeEntry.validateJsonElement(jsonArraydataTypes.get(i)); + } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchUpdateDataTypesItem.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchUpdateDataTypesItem' and its subtypes + if (!CreateAnalysisDataTypesInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAnalysisDataTypesInputBody' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchUpdateDataTypesItem.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAnalysisDataTypesInputBody.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, BatchUpdateDataTypesItem value) throws IOException { + public void write(JsonWriter out, CreateAnalysisDataTypesInputBody value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public BatchUpdateDataTypesItem read(JsonReader in) throws IOException { + public CreateAnalysisDataTypesInputBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -237,18 +204,18 @@ public BatchUpdateDataTypesItem read(JsonReader in) throws IOException { } /** - * Create an instance of BatchUpdateDataTypesItem given an JSON string + * Create an instance of CreateAnalysisDataTypesInputBody given an JSON string * * @param jsonString JSON string - * @return An instance of BatchUpdateDataTypesItem - * @throws IOException if the JSON string is invalid with respect to BatchUpdateDataTypesItem + * @return An instance of CreateAnalysisDataTypesInputBody + * @throws IOException if the JSON string is invalid with respect to CreateAnalysisDataTypesInputBody */ - public static BatchUpdateDataTypesItem fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BatchUpdateDataTypesItem.class); + public static CreateAnalysisDataTypesInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAnalysisDataTypesInputBody.class); } /** - * Convert an instance of BatchUpdateDataTypesItem to an JSON string + * Convert an instance of CreateAnalysisDataTypesInputBody to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/CreateArrayDataType.java b/src/main/java/ai/reveng/model/CreateArrayDataType.java new file mode 100644 index 00000000..f84ce85c --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateArrayDataType.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 ai.reveng.model.ArrayDefinition; +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; + +/** + * CreateArrayDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateArrayDataType { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private ArrayDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + ARRAY("ARRAY"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateArrayDataType() { + } + + public CreateArrayDataType definition(@javax.annotation.Nonnull ArrayDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public ArrayDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull ArrayDefinition definition) { + this.definition = definition; + } + + + public CreateArrayDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateArrayDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateArrayDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateArrayDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateArrayDataType createArrayDataType = (CreateArrayDataType) o; + return Objects.equals(this.definition, createArrayDataType.definition) && + Objects.equals(this.kind, createArrayDataType.kind) && + Objects.equals(this.name, createArrayDataType.name) && + Objects.equals(this.namespace, createArrayDataType.namespace) && + Objects.equals(this.size, createArrayDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateArrayDataType {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("definition", "kind", "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 CreateArrayDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateArrayDataType.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 CreateArrayDataType is not found in the empty JSON string", CreateArrayDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateArrayDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateArrayDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateArrayDataType.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(); + // validate the required field `definition` + ArrayDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateArrayDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateArrayDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateArrayDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateArrayDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateArrayDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateArrayDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateArrayDataType + * @throws IOException if the JSON string is invalid with respect to CreateArrayDataType + */ + public static CreateArrayDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateArrayDataType.class); + } + + /** + * Convert an instance of CreateArrayDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionArgument.java b/src/main/java/ai/reveng/model/CreateBaseDataType.java similarity index 53% rename from src/main/java/ai/reveng/model/FunctionArgument.java rename to src/main/java/ai/reveng/model/CreateBaseDataType.java index 28f2b7f5..62c99dee 100644 --- a/src/main/java/ai/reveng/model/FunctionArgument.java +++ b/src/main/java/ai/reveng/model/CreateBaseDataType.java @@ -45,69 +45,111 @@ import ai.reveng.invoker.JSON; /** - * FunctionArgument + * CreateBaseDataType */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionArgument { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; +public class CreateBaseDataType { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + BASE("BASE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nonnull private String name; - public static final String SERIALIZED_NAME_OFFSET = "offset"; - @SerializedName(SERIALIZED_NAME_OFFSET) - @javax.annotation.Nonnull - private Long offset; - - public static final String SERIALIZED_NAME_SCOPE = "scope"; - @SerializedName(SERIALIZED_NAME_SCOPE) + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) @javax.annotation.Nullable - private String scope; + private String namespace; public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nonnull + @javax.annotation.Nullable private Long size; - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public FunctionArgument() { + public CreateBaseDataType() { } - public FunctionArgument lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; + public CreateBaseDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; return this; } /** - * Get lastChange - * @return lastChange + * Get kind + * @return kind */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; } - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; } - public FunctionArgument name(@javax.annotation.Nonnull String name) { + public CreateBaseDataType name(@javax.annotation.Nonnull String name) { this.name = name; return this; } /** - * Get name + * Type name. Unique within the analysis for a given namespace and kind. * @return name */ @javax.annotation.Nonnull @@ -120,82 +162,45 @@ public void setName(@javax.annotation.Nonnull String name) { } - public FunctionArgument offset(@javax.annotation.Nonnull Long offset) { - this.offset = offset; - return this; - } - - /** - * Get offset - * @return offset - */ - @javax.annotation.Nonnull - public Long getOffset() { - return offset; - } - - public void setOffset(@javax.annotation.Nonnull Long offset) { - this.offset = offset; - } - - - public FunctionArgument scope(@javax.annotation.Nullable String scope) { - this.scope = scope; + public CreateBaseDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; return this; } /** - * Get scope - * @return scope + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace */ @javax.annotation.Nullable - public String getScope() { - return scope; + public String getNamespace() { + return namespace; } - public void setScope(@javax.annotation.Nullable String scope) { - this.scope = scope; + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; } - public FunctionArgument size(@javax.annotation.Nonnull Long size) { + public CreateBaseDataType size(@javax.annotation.Nullable Long size) { this.size = size; return this; } /** - * Get size + * Size in bytes. Omit when it is not known. + * minimum: 0 * @return size */ - @javax.annotation.Nonnull + @javax.annotation.Nullable public Long getSize() { return size; } - public void setSize(@javax.annotation.Nonnull Long size) { + public void setSize(@javax.annotation.Nullable Long size) { this.size = size; } - public FunctionArgument type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - @Override public boolean equals(Object o) { @@ -205,30 +210,26 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FunctionArgument functionArgument = (FunctionArgument) o; - return Objects.equals(this.lastChange, functionArgument.lastChange) && - Objects.equals(this.name, functionArgument.name) && - Objects.equals(this.offset, functionArgument.offset) && - Objects.equals(this.scope, functionArgument.scope) && - Objects.equals(this.size, functionArgument.size) && - Objects.equals(this.type, functionArgument.type); + CreateBaseDataType createBaseDataType = (CreateBaseDataType) o; + return Objects.equals(this.kind, createBaseDataType.kind) && + Objects.equals(this.name, createBaseDataType.name) && + Objects.equals(this.namespace, createBaseDataType.namespace) && + Objects.equals(this.size, createBaseDataType.size); } @Override public int hashCode() { - return Objects.hash(lastChange, name, offset, scope, size, type); + return Objects.hash(kind, name, namespace, size); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class FunctionArgument {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); + sb.append("class CreateBaseDataType {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } @@ -247,51 +248,50 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("last_change", "name", "offset", "scope", "size", "type")); + openapiFields = new HashSet(Arrays.asList("kind", "name", "namespace", "size")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "offset", "size", "type")); + openapiRequiredFields = new HashSet(Arrays.asList("kind", "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 FunctionArgument + * @throws IOException if the JSON Element is invalid with respect to CreateBaseDataType */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!FunctionArgument.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 FunctionArgument is not found in the empty JSON string", FunctionArgument.openapiRequiredFields.toString())); + if (!CreateBaseDataType.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 CreateBaseDataType is not found in the empty JSON string", CreateBaseDataType.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!FunctionArgument.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionArgument` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!CreateBaseDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateBaseDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionArgument.openapiRequiredFields) { + for (String requiredField : CreateBaseDataType.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } - if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); } } @@ -299,22 +299,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionArgument.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionArgument' and its subtypes + if (!CreateBaseDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBaseDataType' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionArgument.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBaseDataType.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, FunctionArgument value) throws IOException { + public void write(JsonWriter out, CreateBaseDataType value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public FunctionArgument read(JsonReader in) throws IOException { + public CreateBaseDataType read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -325,18 +325,18 @@ public FunctionArgument read(JsonReader in) throws IOException { } /** - * Create an instance of FunctionArgument given an JSON string + * Create an instance of CreateBaseDataType given an JSON string * * @param jsonString JSON string - * @return An instance of FunctionArgument - * @throws IOException if the JSON string is invalid with respect to FunctionArgument + * @return An instance of CreateBaseDataType + * @throws IOException if the JSON string is invalid with respect to CreateBaseDataType */ - public static FunctionArgument fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionArgument.class); + public static CreateBaseDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBaseDataType.class); } /** - * Convert an instance of FunctionArgument to an JSON string + * Convert an instance of CreateBaseDataType to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/CreateBitfieldDataType.java b/src/main/java/ai/reveng/model/CreateBitfieldDataType.java new file mode 100644 index 00000000..5b036ffb --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateBitfieldDataType.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; + +/** + * CreateBitfieldDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateBitfieldDataType { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + BITFIELD("BITFIELD"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateBitfieldDataType() { + } + + public CreateBitfieldDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateBitfieldDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateBitfieldDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateBitfieldDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateBitfieldDataType createBitfieldDataType = (CreateBitfieldDataType) o; + return Objects.equals(this.kind, createBitfieldDataType.kind) && + Objects.equals(this.name, createBitfieldDataType.name) && + Objects.equals(this.namespace, createBitfieldDataType.namespace) && + Objects.equals(this.size, createBitfieldDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateBitfieldDataType {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("kind", "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 CreateBitfieldDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateBitfieldDataType.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 CreateBitfieldDataType is not found in the empty JSON string", CreateBitfieldDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateBitfieldDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateBitfieldDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateBitfieldDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateBitfieldDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateBitfieldDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateBitfieldDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateBitfieldDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateBitfieldDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateBitfieldDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateBitfieldDataType + * @throws IOException if the JSON string is invalid with respect to CreateBitfieldDataType + */ + public static CreateBitfieldDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateBitfieldDataType.class); + } + + /** + * Convert an instance of CreateBitfieldDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateDataTypeEntry.java b/src/main/java/ai/reveng/model/CreateDataTypeEntry.java new file mode 100644 index 00000000..04dd6698 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateDataTypeEntry.java @@ -0,0 +1,645 @@ +/* + * 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.CreateArrayDataType; +import ai.reveng.model.CreateBaseDataType; +import ai.reveng.model.CreateBitfieldDataType; +import ai.reveng.model.CreateEnumDataType; +import ai.reveng.model.CreateFunctionDataType; +import ai.reveng.model.CreatePointerDataType; +import ai.reveng.model.CreateStructDataType; +import ai.reveng.model.CreateTypedefDataType; +import ai.reveng.model.CreateUnionDataType; +import ai.reveng.model.CreateUnknownDataType; +import ai.reveng.model.FunctionTypeDefinition; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import ai.reveng.invoker.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateDataTypeEntry extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CreateDataTypeEntry.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateDataTypeEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateDataTypeEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterCreateStructDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateStructDataType.class)); + final TypeAdapter adapterCreateUnionDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateUnionDataType.class)); + final TypeAdapter adapterCreateEnumDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateEnumDataType.class)); + final TypeAdapter adapterCreateTypedefDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateTypedefDataType.class)); + final TypeAdapter adapterCreatePointerDataType = gson.getDelegateAdapter(this, TypeToken.get(CreatePointerDataType.class)); + final TypeAdapter adapterCreateArrayDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateArrayDataType.class)); + final TypeAdapter adapterCreateFunctionDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionDataType.class)); + final TypeAdapter adapterCreateBitfieldDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateBitfieldDataType.class)); + final TypeAdapter adapterCreateBaseDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateBaseDataType.class)); + final TypeAdapter adapterCreateUnknownDataType = gson.getDelegateAdapter(this, TypeToken.get(CreateUnknownDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateDataTypeEntry value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `CreateStructDataType` + if (value.getActualInstance() instanceof CreateStructDataType) { + JsonElement element = adapterCreateStructDataType.toJsonTree((CreateStructDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateUnionDataType` + if (value.getActualInstance() instanceof CreateUnionDataType) { + JsonElement element = adapterCreateUnionDataType.toJsonTree((CreateUnionDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateEnumDataType` + if (value.getActualInstance() instanceof CreateEnumDataType) { + JsonElement element = adapterCreateEnumDataType.toJsonTree((CreateEnumDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateTypedefDataType` + if (value.getActualInstance() instanceof CreateTypedefDataType) { + JsonElement element = adapterCreateTypedefDataType.toJsonTree((CreateTypedefDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreatePointerDataType` + if (value.getActualInstance() instanceof CreatePointerDataType) { + JsonElement element = adapterCreatePointerDataType.toJsonTree((CreatePointerDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateArrayDataType` + if (value.getActualInstance() instanceof CreateArrayDataType) { + JsonElement element = adapterCreateArrayDataType.toJsonTree((CreateArrayDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateFunctionDataType` + if (value.getActualInstance() instanceof CreateFunctionDataType) { + JsonElement element = adapterCreateFunctionDataType.toJsonTree((CreateFunctionDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBitfieldDataType` + if (value.getActualInstance() instanceof CreateBitfieldDataType) { + JsonElement element = adapterCreateBitfieldDataType.toJsonTree((CreateBitfieldDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateBaseDataType` + if (value.getActualInstance() instanceof CreateBaseDataType) { + JsonElement element = adapterCreateBaseDataType.toJsonTree((CreateBaseDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `CreateUnknownDataType` + if (value.getActualInstance() instanceof CreateUnknownDataType) { + JsonElement element = adapterCreateUnknownDataType.toJsonTree((CreateUnknownDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreateArrayDataType, CreateBaseDataType, CreateBitfieldDataType, CreateEnumDataType, CreateFunctionDataType, CreatePointerDataType, CreateStructDataType, CreateTypedefDataType, CreateUnionDataType, CreateUnknownDataType"); + } + + @Override + public CreateDataTypeEntry read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize CreateStructDataType + try { + // validate the JSON object to see if any exception is thrown + CreateStructDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateStructDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateStructDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateStructDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateStructDataType'", e); + } + // deserialize CreateUnionDataType + try { + // validate the JSON object to see if any exception is thrown + CreateUnionDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateUnionDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateUnionDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateUnionDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateUnionDataType'", e); + } + // deserialize CreateEnumDataType + try { + // validate the JSON object to see if any exception is thrown + CreateEnumDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateEnumDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateEnumDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateEnumDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateEnumDataType'", e); + } + // deserialize CreateTypedefDataType + try { + // validate the JSON object to see if any exception is thrown + CreateTypedefDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateTypedefDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateTypedefDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateTypedefDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateTypedefDataType'", e); + } + // deserialize CreatePointerDataType + try { + // validate the JSON object to see if any exception is thrown + CreatePointerDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreatePointerDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreatePointerDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreatePointerDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreatePointerDataType'", e); + } + // deserialize CreateArrayDataType + try { + // validate the JSON object to see if any exception is thrown + CreateArrayDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateArrayDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateArrayDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateArrayDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateArrayDataType'", e); + } + // deserialize CreateFunctionDataType + try { + // validate the JSON object to see if any exception is thrown + CreateFunctionDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateFunctionDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateFunctionDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateFunctionDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateFunctionDataType'", e); + } + // deserialize CreateBitfieldDataType + try { + // validate the JSON object to see if any exception is thrown + CreateBitfieldDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBitfieldDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBitfieldDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateBitfieldDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBitfieldDataType'", e); + } + // deserialize CreateBaseDataType + try { + // validate the JSON object to see if any exception is thrown + CreateBaseDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateBaseDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateBaseDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateBaseDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateBaseDataType'", e); + } + // deserialize CreateUnknownDataType + try { + // validate the JSON object to see if any exception is thrown + CreateUnknownDataType.validateJsonElement(jsonElement); + actualAdapter = adapterCreateUnknownDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'CreateUnknownDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateUnknownDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'CreateUnknownDataType'", e); + } + + if (match == 1) { + CreateDataTypeEntry ret = new CreateDataTypeEntry(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for CreateDataTypeEntry: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public CreateDataTypeEntry() { + super("oneOf", Boolean.FALSE); + } + + public CreateDataTypeEntry(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CreateStructDataType", CreateStructDataType.class); + schemas.put("CreateUnionDataType", CreateUnionDataType.class); + schemas.put("CreateEnumDataType", CreateEnumDataType.class); + schemas.put("CreateTypedefDataType", CreateTypedefDataType.class); + schemas.put("CreatePointerDataType", CreatePointerDataType.class); + schemas.put("CreateArrayDataType", CreateArrayDataType.class); + schemas.put("CreateFunctionDataType", CreateFunctionDataType.class); + schemas.put("CreateBitfieldDataType", CreateBitfieldDataType.class); + schemas.put("CreateBaseDataType", CreateBaseDataType.class); + schemas.put("CreateUnknownDataType", CreateUnknownDataType.class); + } + + @Override + public Map> getSchemas() { + return CreateDataTypeEntry.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CreateArrayDataType, CreateBaseDataType, CreateBitfieldDataType, CreateEnumDataType, CreateFunctionDataType, CreatePointerDataType, CreateStructDataType, CreateTypedefDataType, CreateUnionDataType, CreateUnknownDataType + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof CreateStructDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateUnionDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateEnumDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateTypedefDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreatePointerDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateArrayDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateFunctionDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBitfieldDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateBaseDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof CreateUnknownDataType) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CreateArrayDataType, CreateBaseDataType, CreateBitfieldDataType, CreateEnumDataType, CreateFunctionDataType, CreatePointerDataType, CreateStructDataType, CreateTypedefDataType, CreateUnionDataType, CreateUnknownDataType"); + } + + /** + * Get the actual instance, which can be the following: + * CreateArrayDataType, CreateBaseDataType, CreateBitfieldDataType, CreateEnumDataType, CreateFunctionDataType, CreatePointerDataType, CreateStructDataType, CreateTypedefDataType, CreateUnionDataType, CreateUnknownDataType + * + * @return The actual instance (CreateArrayDataType, CreateBaseDataType, CreateBitfieldDataType, CreateEnumDataType, CreateFunctionDataType, CreatePointerDataType, CreateStructDataType, CreateTypedefDataType, CreateUnionDataType, CreateUnknownDataType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateStructDataType`. If the actual instance is not `CreateStructDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateStructDataType` + * @throws ClassCastException if the instance is not `CreateStructDataType` + */ + @SuppressWarnings("unchecked") + public CreateStructDataType getCreateStructDataType() throws ClassCastException { + return (CreateStructDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateUnionDataType`. If the actual instance is not `CreateUnionDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateUnionDataType` + * @throws ClassCastException if the instance is not `CreateUnionDataType` + */ + @SuppressWarnings("unchecked") + public CreateUnionDataType getCreateUnionDataType() throws ClassCastException { + return (CreateUnionDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateEnumDataType`. If the actual instance is not `CreateEnumDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateEnumDataType` + * @throws ClassCastException if the instance is not `CreateEnumDataType` + */ + @SuppressWarnings("unchecked") + public CreateEnumDataType getCreateEnumDataType() throws ClassCastException { + return (CreateEnumDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateTypedefDataType`. If the actual instance is not `CreateTypedefDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateTypedefDataType` + * @throws ClassCastException if the instance is not `CreateTypedefDataType` + */ + @SuppressWarnings("unchecked") + public CreateTypedefDataType getCreateTypedefDataType() throws ClassCastException { + return (CreateTypedefDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreatePointerDataType`. If the actual instance is not `CreatePointerDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreatePointerDataType` + * @throws ClassCastException if the instance is not `CreatePointerDataType` + */ + @SuppressWarnings("unchecked") + public CreatePointerDataType getCreatePointerDataType() throws ClassCastException { + return (CreatePointerDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateArrayDataType`. If the actual instance is not `CreateArrayDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateArrayDataType` + * @throws ClassCastException if the instance is not `CreateArrayDataType` + */ + @SuppressWarnings("unchecked") + public CreateArrayDataType getCreateArrayDataType() throws ClassCastException { + return (CreateArrayDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateFunctionDataType`. If the actual instance is not `CreateFunctionDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateFunctionDataType` + * @throws ClassCastException if the instance is not `CreateFunctionDataType` + */ + @SuppressWarnings("unchecked") + public CreateFunctionDataType getCreateFunctionDataType() throws ClassCastException { + return (CreateFunctionDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateBitfieldDataType`. If the actual instance is not `CreateBitfieldDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBitfieldDataType` + * @throws ClassCastException if the instance is not `CreateBitfieldDataType` + */ + @SuppressWarnings("unchecked") + public CreateBitfieldDataType getCreateBitfieldDataType() throws ClassCastException { + return (CreateBitfieldDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateBaseDataType`. If the actual instance is not `CreateBaseDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateBaseDataType` + * @throws ClassCastException if the instance is not `CreateBaseDataType` + */ + @SuppressWarnings("unchecked") + public CreateBaseDataType getCreateBaseDataType() throws ClassCastException { + return (CreateBaseDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `CreateUnknownDataType`. If the actual instance is not `CreateUnknownDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CreateUnknownDataType` + * @throws ClassCastException if the instance is not `CreateUnknownDataType` + */ + @SuppressWarnings("unchecked") + public CreateUnknownDataType getCreateUnknownDataType() throws ClassCastException { + return (CreateUnknownDataType)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateDataTypeEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with CreateStructDataType + try { + CreateStructDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateStructDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateUnionDataType + try { + CreateUnionDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateUnionDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateEnumDataType + try { + CreateEnumDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateEnumDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateTypedefDataType + try { + CreateTypedefDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateTypedefDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreatePointerDataType + try { + CreatePointerDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreatePointerDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateArrayDataType + try { + CreateArrayDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateArrayDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateFunctionDataType + try { + CreateFunctionDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateFunctionDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBitfieldDataType + try { + CreateBitfieldDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateBitfieldDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateBaseDataType + try { + CreateBaseDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateBaseDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with CreateUnknownDataType + try { + CreateUnknownDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for CreateUnknownDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for CreateDataTypeEntry with oneOf schemas: CreateArrayDataType, CreateBaseDataType, CreateBitfieldDataType, CreateEnumDataType, CreateFunctionDataType, CreatePointerDataType, CreateStructDataType, CreateTypedefDataType, CreateUnionDataType, CreateUnknownDataType. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of CreateDataTypeEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateDataTypeEntry + * @throws IOException if the JSON string is invalid with respect to CreateDataTypeEntry + */ + public static CreateDataTypeEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateDataTypeEntry.class); + } + + /** + * Convert an instance of CreateDataTypeEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateEnumDataType.java b/src/main/java/ai/reveng/model/CreateEnumDataType.java new file mode 100644 index 00000000..912bfe45 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateEnumDataType.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 ai.reveng.model.EnumDefinition; +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; + +/** + * CreateEnumDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateEnumDataType { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private EnumDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + ENUM("ENUM"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateEnumDataType() { + } + + public CreateEnumDataType definition(@javax.annotation.Nonnull EnumDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public EnumDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull EnumDefinition definition) { + this.definition = definition; + } + + + public CreateEnumDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateEnumDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateEnumDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateEnumDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateEnumDataType createEnumDataType = (CreateEnumDataType) o; + return Objects.equals(this.definition, createEnumDataType.definition) && + Objects.equals(this.kind, createEnumDataType.kind) && + Objects.equals(this.name, createEnumDataType.name) && + Objects.equals(this.namespace, createEnumDataType.namespace) && + Objects.equals(this.size, createEnumDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEnumDataType {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("definition", "kind", "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 CreateEnumDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEnumDataType.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 CreateEnumDataType is not found in the empty JSON string", CreateEnumDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateEnumDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateEnumDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEnumDataType.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(); + // validate the required field `definition` + EnumDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEnumDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEnumDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateEnumDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEnumDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateEnumDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateEnumDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEnumDataType + * @throws IOException if the JSON string is invalid with respect to CreateEnumDataType + */ + public static CreateEnumDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEnumDataType.class); + } + + /** + * Convert an instance of CreateEnumDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateFunctionDataType.java b/src/main/java/ai/reveng/model/CreateFunctionDataType.java new file mode 100644 index 00000000..ae0a231a --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateFunctionDataType.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 ai.reveng.model.FunctionTypeDefinition; +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; + +/** + * CreateFunctionDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateFunctionDataType { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private FunctionTypeDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + FUNCTION_DEFINITION("FUNCTION_DEFINITION"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateFunctionDataType() { + } + + public CreateFunctionDataType definition(@javax.annotation.Nonnull FunctionTypeDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public FunctionTypeDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull FunctionTypeDefinition definition) { + this.definition = definition; + } + + + public CreateFunctionDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateFunctionDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateFunctionDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateFunctionDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateFunctionDataType createFunctionDataType = (CreateFunctionDataType) o; + return Objects.equals(this.definition, createFunctionDataType.definition) && + Objects.equals(this.kind, createFunctionDataType.kind) && + Objects.equals(this.name, createFunctionDataType.name) && + Objects.equals(this.namespace, createFunctionDataType.namespace) && + Objects.equals(this.size, createFunctionDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateFunctionDataType {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("definition", "kind", "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 CreateFunctionDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateFunctionDataType.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 CreateFunctionDataType is not found in the empty JSON string", CreateFunctionDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateFunctionDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateFunctionDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateFunctionDataType.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(); + // validate the required field `definition` + FunctionTypeDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateFunctionDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateFunctionDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateFunctionDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateFunctionDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateFunctionDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateFunctionDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateFunctionDataType + * @throws IOException if the JSON string is invalid with respect to CreateFunctionDataType + */ + public static CreateFunctionDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateFunctionDataType.class); + } + + /** + * Convert an instance of CreateFunctionDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreatePointerDataType.java b/src/main/java/ai/reveng/model/CreatePointerDataType.java new file mode 100644 index 00000000..bdfedcbc --- /dev/null +++ b/src/main/java/ai/reveng/model/CreatePointerDataType.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 ai.reveng.model.PointerDefinition; +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; + +/** + * CreatePointerDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreatePointerDataType { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private PointerDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + POINTER("POINTER"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreatePointerDataType() { + } + + public CreatePointerDataType definition(@javax.annotation.Nonnull PointerDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public PointerDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull PointerDefinition definition) { + this.definition = definition; + } + + + public CreatePointerDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreatePointerDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreatePointerDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreatePointerDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePointerDataType createPointerDataType = (CreatePointerDataType) o; + return Objects.equals(this.definition, createPointerDataType.definition) && + Objects.equals(this.kind, createPointerDataType.kind) && + Objects.equals(this.name, createPointerDataType.name) && + Objects.equals(this.namespace, createPointerDataType.namespace) && + Objects.equals(this.size, createPointerDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePointerDataType {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("definition", "kind", "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 CreatePointerDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePointerDataType.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 CreatePointerDataType is not found in the empty JSON string", CreatePointerDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreatePointerDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreatePointerDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePointerDataType.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(); + // validate the required field `definition` + PointerDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePointerDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePointerDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePointerDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePointerDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreatePointerDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePointerDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePointerDataType + * @throws IOException if the JSON string is invalid with respect to CreatePointerDataType + */ + public static CreatePointerDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePointerDataType.class); + } + + /** + * Convert an instance of CreatePointerDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateStructDataType.java b/src/main/java/ai/reveng/model/CreateStructDataType.java new file mode 100644 index 00000000..cbc80db1 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateStructDataType.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 ai.reveng.model.StructDefinition; +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; + +/** + * CreateStructDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateStructDataType { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private StructDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + STRUCT("STRUCT"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateStructDataType() { + } + + public CreateStructDataType definition(@javax.annotation.Nonnull StructDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public StructDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull StructDefinition definition) { + this.definition = definition; + } + + + public CreateStructDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateStructDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateStructDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateStructDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateStructDataType createStructDataType = (CreateStructDataType) o; + return Objects.equals(this.definition, createStructDataType.definition) && + Objects.equals(this.kind, createStructDataType.kind) && + Objects.equals(this.name, createStructDataType.name) && + Objects.equals(this.namespace, createStructDataType.namespace) && + Objects.equals(this.size, createStructDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateStructDataType {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("definition", "kind", "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 CreateStructDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateStructDataType.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 CreateStructDataType is not found in the empty JSON string", CreateStructDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateStructDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateStructDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateStructDataType.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(); + // validate the required field `definition` + StructDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateStructDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateStructDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateStructDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateStructDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateStructDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateStructDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateStructDataType + * @throws IOException if the JSON string is invalid with respect to CreateStructDataType + */ + public static CreateStructDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateStructDataType.class); + } + + /** + * Convert an instance of CreateStructDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateTypedefDataType.java b/src/main/java/ai/reveng/model/CreateTypedefDataType.java new file mode 100644 index 00000000..247354ef --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateTypedefDataType.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 ai.reveng.model.TypedefDefinition; +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; + +/** + * CreateTypedefDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateTypedefDataType { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private TypedefDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + TYPEDEF("TYPEDEF"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateTypedefDataType() { + } + + public CreateTypedefDataType definition(@javax.annotation.Nonnull TypedefDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public TypedefDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull TypedefDefinition definition) { + this.definition = definition; + } + + + public CreateTypedefDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateTypedefDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateTypedefDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateTypedefDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTypedefDataType createTypedefDataType = (CreateTypedefDataType) o; + return Objects.equals(this.definition, createTypedefDataType.definition) && + Objects.equals(this.kind, createTypedefDataType.kind) && + Objects.equals(this.name, createTypedefDataType.name) && + Objects.equals(this.namespace, createTypedefDataType.namespace) && + Objects.equals(this.size, createTypedefDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTypedefDataType {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("definition", "kind", "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 CreateTypedefDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTypedefDataType.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 CreateTypedefDataType is not found in the empty JSON string", CreateTypedefDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTypedefDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateTypedefDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTypedefDataType.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(); + // validate the required field `definition` + TypedefDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTypedefDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTypedefDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateTypedefDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTypedefDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTypedefDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTypedefDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTypedefDataType + * @throws IOException if the JSON string is invalid with respect to CreateTypedefDataType + */ + public static CreateTypedefDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTypedefDataType.class); + } + + /** + * Convert an instance of CreateTypedefDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateUnionDataType.java b/src/main/java/ai/reveng/model/CreateUnionDataType.java new file mode 100644 index 00000000..7f235ee6 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateUnionDataType.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 ai.reveng.model.UnionDefinition; +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; + +/** + * CreateUnionDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateUnionDataType { + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private UnionDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + UNION("UNION"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateUnionDataType() { + } + + public CreateUnionDataType definition(@javax.annotation.Nonnull UnionDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public UnionDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull UnionDefinition definition) { + this.definition = definition; + } + + + public CreateUnionDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateUnionDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateUnionDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateUnionDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateUnionDataType createUnionDataType = (CreateUnionDataType) o; + return Objects.equals(this.definition, createUnionDataType.definition) && + Objects.equals(this.kind, createUnionDataType.kind) && + Objects.equals(this.name, createUnionDataType.name) && + Objects.equals(this.namespace, createUnionDataType.namespace) && + Objects.equals(this.size, createUnionDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateUnionDataType {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("definition", "kind", "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 CreateUnionDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateUnionDataType.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 CreateUnionDataType is not found in the empty JSON string", CreateUnionDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateUnionDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateUnionDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateUnionDataType.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(); + // validate the required field `definition` + UnionDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateUnionDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateUnionDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateUnionDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateUnionDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateUnionDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateUnionDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateUnionDataType + * @throws IOException if the JSON string is invalid with respect to CreateUnionDataType + */ + public static CreateUnionDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateUnionDataType.class); + } + + /** + * Convert an instance of CreateUnionDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/CreateUnknownDataType.java b/src/main/java/ai/reveng/model/CreateUnknownDataType.java new file mode 100644 index 00000000..ad827f60 --- /dev/null +++ b/src/main/java/ai/reveng/model/CreateUnknownDataType.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; + +/** + * CreateUnknownDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class CreateUnknownDataType { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + UNKNOWN("UNKNOWN"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public CreateUnknownDataType() { + } + + public CreateUnknownDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public CreateUnknownDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public CreateUnknownDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public CreateUnknownDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateUnknownDataType createUnknownDataType = (CreateUnknownDataType) o; + return Objects.equals(this.kind, createUnknownDataType.kind) && + Objects.equals(this.name, createUnknownDataType.name) && + Objects.equals(this.namespace, createUnknownDataType.namespace) && + Objects.equals(this.size, createUnknownDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateUnknownDataType {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).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("kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("kind", "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 CreateUnknownDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateUnknownDataType.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 CreateUnknownDataType is not found in the empty JSON string", CreateUnknownDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateUnknownDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `CreateUnknownDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateUnknownDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateUnknownDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateUnknownDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateUnknownDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateUnknownDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateUnknownDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateUnknownDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateUnknownDataType + * @throws IOException if the JSON string is invalid with respect to CreateUnknownDataType + */ + public static CreateUnknownDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateUnknownDataType.class); + } + + /** + * Convert an instance of CreateUnknownDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DataTypeEntry.java b/src/main/java/ai/reveng/model/DataTypeEntry.java new file mode 100644 index 00000000..19081c69 --- /dev/null +++ b/src/main/java/ai/reveng/model/DataTypeEntry.java @@ -0,0 +1,646 @@ +/* + * 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.ArrayDataType; +import ai.reveng.model.BaseDataType; +import ai.reveng.model.BitfieldDataType; +import ai.reveng.model.EnumDataType; +import ai.reveng.model.FunctionDataType; +import ai.reveng.model.FunctionTypeDefinition; +import ai.reveng.model.PointerDataType; +import ai.reveng.model.StructDataType; +import ai.reveng.model.TypedefDataType; +import ai.reveng.model.UnionDataType; +import ai.reveng.model.UnknownDataType; +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 java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import ai.reveng.invoker.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DataTypeEntry extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(DataTypeEntry.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DataTypeEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DataTypeEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterStructDataType = gson.getDelegateAdapter(this, TypeToken.get(StructDataType.class)); + final TypeAdapter adapterUnionDataType = gson.getDelegateAdapter(this, TypeToken.get(UnionDataType.class)); + final TypeAdapter adapterEnumDataType = gson.getDelegateAdapter(this, TypeToken.get(EnumDataType.class)); + final TypeAdapter adapterTypedefDataType = gson.getDelegateAdapter(this, TypeToken.get(TypedefDataType.class)); + final TypeAdapter adapterPointerDataType = gson.getDelegateAdapter(this, TypeToken.get(PointerDataType.class)); + final TypeAdapter adapterArrayDataType = gson.getDelegateAdapter(this, TypeToken.get(ArrayDataType.class)); + final TypeAdapter adapterFunctionDataType = gson.getDelegateAdapter(this, TypeToken.get(FunctionDataType.class)); + final TypeAdapter adapterBitfieldDataType = gson.getDelegateAdapter(this, TypeToken.get(BitfieldDataType.class)); + final TypeAdapter adapterBaseDataType = gson.getDelegateAdapter(this, TypeToken.get(BaseDataType.class)); + final TypeAdapter adapterUnknownDataType = gson.getDelegateAdapter(this, TypeToken.get(UnknownDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DataTypeEntry value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `StructDataType` + if (value.getActualInstance() instanceof StructDataType) { + JsonElement element = adapterStructDataType.toJsonTree((StructDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UnionDataType` + if (value.getActualInstance() instanceof UnionDataType) { + JsonElement element = adapterUnionDataType.toJsonTree((UnionDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `EnumDataType` + if (value.getActualInstance() instanceof EnumDataType) { + JsonElement element = adapterEnumDataType.toJsonTree((EnumDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `TypedefDataType` + if (value.getActualInstance() instanceof TypedefDataType) { + JsonElement element = adapterTypedefDataType.toJsonTree((TypedefDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `PointerDataType` + if (value.getActualInstance() instanceof PointerDataType) { + JsonElement element = adapterPointerDataType.toJsonTree((PointerDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `ArrayDataType` + if (value.getActualInstance() instanceof ArrayDataType) { + JsonElement element = adapterArrayDataType.toJsonTree((ArrayDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `FunctionDataType` + if (value.getActualInstance() instanceof FunctionDataType) { + JsonElement element = adapterFunctionDataType.toJsonTree((FunctionDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `BitfieldDataType` + if (value.getActualInstance() instanceof BitfieldDataType) { + JsonElement element = adapterBitfieldDataType.toJsonTree((BitfieldDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `BaseDataType` + if (value.getActualInstance() instanceof BaseDataType) { + JsonElement element = adapterBaseDataType.toJsonTree((BaseDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UnknownDataType` + if (value.getActualInstance() instanceof UnknownDataType) { + JsonElement element = adapterUnknownDataType.toJsonTree((UnknownDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: ArrayDataType, BaseDataType, BitfieldDataType, EnumDataType, FunctionDataType, PointerDataType, StructDataType, TypedefDataType, UnionDataType, UnknownDataType"); + } + + @Override + public DataTypeEntry read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize StructDataType + try { + // validate the JSON object to see if any exception is thrown + StructDataType.validateJsonElement(jsonElement); + actualAdapter = adapterStructDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'StructDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for StructDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'StructDataType'", e); + } + // deserialize UnionDataType + try { + // validate the JSON object to see if any exception is thrown + UnionDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUnionDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UnionDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UnionDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UnionDataType'", e); + } + // deserialize EnumDataType + try { + // validate the JSON object to see if any exception is thrown + EnumDataType.validateJsonElement(jsonElement); + actualAdapter = adapterEnumDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'EnumDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EnumDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'EnumDataType'", e); + } + // deserialize TypedefDataType + try { + // validate the JSON object to see if any exception is thrown + TypedefDataType.validateJsonElement(jsonElement); + actualAdapter = adapterTypedefDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'TypedefDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for TypedefDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'TypedefDataType'", e); + } + // deserialize PointerDataType + try { + // validate the JSON object to see if any exception is thrown + PointerDataType.validateJsonElement(jsonElement); + actualAdapter = adapterPointerDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'PointerDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for PointerDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'PointerDataType'", e); + } + // deserialize ArrayDataType + try { + // validate the JSON object to see if any exception is thrown + ArrayDataType.validateJsonElement(jsonElement); + actualAdapter = adapterArrayDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'ArrayDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for ArrayDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'ArrayDataType'", e); + } + // deserialize FunctionDataType + try { + // validate the JSON object to see if any exception is thrown + FunctionDataType.validateJsonElement(jsonElement); + actualAdapter = adapterFunctionDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'FunctionDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for FunctionDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'FunctionDataType'", e); + } + // deserialize BitfieldDataType + try { + // validate the JSON object to see if any exception is thrown + BitfieldDataType.validateJsonElement(jsonElement); + actualAdapter = adapterBitfieldDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'BitfieldDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for BitfieldDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BitfieldDataType'", e); + } + // deserialize BaseDataType + try { + // validate the JSON object to see if any exception is thrown + BaseDataType.validateJsonElement(jsonElement); + actualAdapter = adapterBaseDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'BaseDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for BaseDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'BaseDataType'", e); + } + // deserialize UnknownDataType + try { + // validate the JSON object to see if any exception is thrown + UnknownDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUnknownDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UnknownDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UnknownDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UnknownDataType'", e); + } + + if (match == 1) { + DataTypeEntry ret = new DataTypeEntry(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for DataTypeEntry: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public DataTypeEntry() { + super("oneOf", Boolean.FALSE); + } + + public DataTypeEntry(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("StructDataType", StructDataType.class); + schemas.put("UnionDataType", UnionDataType.class); + schemas.put("EnumDataType", EnumDataType.class); + schemas.put("TypedefDataType", TypedefDataType.class); + schemas.put("PointerDataType", PointerDataType.class); + schemas.put("ArrayDataType", ArrayDataType.class); + schemas.put("FunctionDataType", FunctionDataType.class); + schemas.put("BitfieldDataType", BitfieldDataType.class); + schemas.put("BaseDataType", BaseDataType.class); + schemas.put("UnknownDataType", UnknownDataType.class); + } + + @Override + public Map> getSchemas() { + return DataTypeEntry.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * ArrayDataType, BaseDataType, BitfieldDataType, EnumDataType, FunctionDataType, PointerDataType, StructDataType, TypedefDataType, UnionDataType, UnknownDataType + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof StructDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UnionDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof EnumDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof TypedefDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof PointerDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ArrayDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof FunctionDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof BitfieldDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof BaseDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UnknownDataType) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ArrayDataType, BaseDataType, BitfieldDataType, EnumDataType, FunctionDataType, PointerDataType, StructDataType, TypedefDataType, UnionDataType, UnknownDataType"); + } + + /** + * Get the actual instance, which can be the following: + * ArrayDataType, BaseDataType, BitfieldDataType, EnumDataType, FunctionDataType, PointerDataType, StructDataType, TypedefDataType, UnionDataType, UnknownDataType + * + * @return The actual instance (ArrayDataType, BaseDataType, BitfieldDataType, EnumDataType, FunctionDataType, PointerDataType, StructDataType, TypedefDataType, UnionDataType, UnknownDataType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `StructDataType`. If the actual instance is not `StructDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `StructDataType` + * @throws ClassCastException if the instance is not `StructDataType` + */ + @SuppressWarnings("unchecked") + public StructDataType getStructDataType() throws ClassCastException { + return (StructDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UnionDataType`. If the actual instance is not `UnionDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UnionDataType` + * @throws ClassCastException if the instance is not `UnionDataType` + */ + @SuppressWarnings("unchecked") + public UnionDataType getUnionDataType() throws ClassCastException { + return (UnionDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `EnumDataType`. If the actual instance is not `EnumDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `EnumDataType` + * @throws ClassCastException if the instance is not `EnumDataType` + */ + @SuppressWarnings("unchecked") + public EnumDataType getEnumDataType() throws ClassCastException { + return (EnumDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `TypedefDataType`. If the actual instance is not `TypedefDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `TypedefDataType` + * @throws ClassCastException if the instance is not `TypedefDataType` + */ + @SuppressWarnings("unchecked") + public TypedefDataType getTypedefDataType() throws ClassCastException { + return (TypedefDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `PointerDataType`. If the actual instance is not `PointerDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `PointerDataType` + * @throws ClassCastException if the instance is not `PointerDataType` + */ + @SuppressWarnings("unchecked") + public PointerDataType getPointerDataType() throws ClassCastException { + return (PointerDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `ArrayDataType`. If the actual instance is not `ArrayDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `ArrayDataType` + * @throws ClassCastException if the instance is not `ArrayDataType` + */ + @SuppressWarnings("unchecked") + public ArrayDataType getArrayDataType() throws ClassCastException { + return (ArrayDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `FunctionDataType`. If the actual instance is not `FunctionDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `FunctionDataType` + * @throws ClassCastException if the instance is not `FunctionDataType` + */ + @SuppressWarnings("unchecked") + public FunctionDataType getFunctionDataType() throws ClassCastException { + return (FunctionDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `BitfieldDataType`. If the actual instance is not `BitfieldDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BitfieldDataType` + * @throws ClassCastException if the instance is not `BitfieldDataType` + */ + @SuppressWarnings("unchecked") + public BitfieldDataType getBitfieldDataType() throws ClassCastException { + return (BitfieldDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `BaseDataType`. If the actual instance is not `BaseDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `BaseDataType` + * @throws ClassCastException if the instance is not `BaseDataType` + */ + @SuppressWarnings("unchecked") + public BaseDataType getBaseDataType() throws ClassCastException { + return (BaseDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UnknownDataType`. If the actual instance is not `UnknownDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UnknownDataType` + * @throws ClassCastException if the instance is not `UnknownDataType` + */ + @SuppressWarnings("unchecked") + public UnknownDataType getUnknownDataType() throws ClassCastException { + return (UnknownDataType)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DataTypeEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with StructDataType + try { + StructDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for StructDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UnionDataType + try { + UnionDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UnionDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with EnumDataType + try { + EnumDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for EnumDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with TypedefDataType + try { + TypedefDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for TypedefDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with PointerDataType + try { + PointerDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for PointerDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with ArrayDataType + try { + ArrayDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for ArrayDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with FunctionDataType + try { + FunctionDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for FunctionDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with BitfieldDataType + try { + BitfieldDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for BitfieldDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with BaseDataType + try { + BaseDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for BaseDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UnknownDataType + try { + UnknownDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UnknownDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for DataTypeEntry with oneOf schemas: ArrayDataType, BaseDataType, BitfieldDataType, EnumDataType, FunctionDataType, PointerDataType, StructDataType, TypedefDataType, UnionDataType, UnknownDataType. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of DataTypeEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of DataTypeEntry + * @throws IOException if the JSON string is invalid with respect to DataTypeEntry + */ + public static DataTypeEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DataTypeEntry.class); + } + + /** + * Convert an instance of DataTypeEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/AIDecompInverseFunctionMapItem.java b/src/main/java/ai/reveng/model/DataTypeEnumValueEntry.java similarity index 60% rename from src/main/java/ai/reveng/model/AIDecompInverseFunctionMapItem.java rename to src/main/java/ai/reveng/model/DataTypeEnumValueEntry.java index 9f40aa1e..fee12498 100644 --- a/src/main/java/ai/reveng/model/AIDecompInverseFunctionMapItem.java +++ b/src/main/java/ai/reveng/model/DataTypeEnumValueEntry.java @@ -45,82 +45,58 @@ import ai.reveng.invoker.JSON; /** - * AIDecompInverseFunctionMapItem + * DataTypeEnumValueEntry */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AIDecompInverseFunctionMapItem { - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nullable - private Long addr; - - public static final String SERIALIZED_NAME_IS_EXTERNAL = "is_external"; - @SerializedName(SERIALIZED_NAME_IS_EXTERNAL) - @javax.annotation.Nonnull - private Boolean isExternal; - +public class DataTypeEnumValueEntry { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nonnull private String name; - public AIDecompInverseFunctionMapItem() { - } - - public AIDecompInverseFunctionMapItem addr(@javax.annotation.Nullable Long addr) { - this.addr = addr; - return this; - } - - /** - * Get addr - * @return addr - */ - @javax.annotation.Nullable - public Long getAddr() { - return addr; - } + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; - public void setAddr(@javax.annotation.Nullable Long addr) { - this.addr = addr; + public DataTypeEnumValueEntry() { } - - public AIDecompInverseFunctionMapItem isExternal(@javax.annotation.Nonnull Boolean isExternal) { - this.isExternal = isExternal; + public DataTypeEnumValueEntry name(@javax.annotation.Nonnull String name) { + this.name = name; return this; } /** - * Get isExternal - * @return isExternal + * Constant name. + * @return name */ @javax.annotation.Nonnull - public Boolean getIsExternal() { - return isExternal; + public String getName() { + return name; } - public void setIsExternal(@javax.annotation.Nonnull Boolean isExternal) { - this.isExternal = isExternal; + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; } - public AIDecompInverseFunctionMapItem name(@javax.annotation.Nonnull String name) { - this.name = name; + public DataTypeEnumValueEntry value(@javax.annotation.Nonnull String value) { + this.value = value; return this; } /** - * Get name - * @return name + * Constant value, a decimal integer as a string, with no leading zeros. A string because the value may be negative or exceed 64 unsigned bits, which a JSON number cannot carry safely. + * @return value */ @javax.annotation.Nonnull - public String getName() { - return name; + public String getValue() { + return value; } - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; } @@ -133,24 +109,22 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AIDecompInverseFunctionMapItem aiDecompInverseFunctionMapItem = (AIDecompInverseFunctionMapItem) o; - return Objects.equals(this.addr, aiDecompInverseFunctionMapItem.addr) && - Objects.equals(this.isExternal, aiDecompInverseFunctionMapItem.isExternal) && - Objects.equals(this.name, aiDecompInverseFunctionMapItem.name); + DataTypeEnumValueEntry dataTypeEnumValueEntry = (DataTypeEnumValueEntry) o; + return Objects.equals(this.name, dataTypeEnumValueEntry.name) && + Objects.equals(this.value, dataTypeEnumValueEntry.value); } @Override public int hashCode() { - return Objects.hash(addr, isExternal, name); + return Objects.hash(name, value); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AIDecompInverseFunctionMapItem {\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" isExternal: ").append(toIndentedString(isExternal)).append("\n"); + sb.append("class DataTypeEnumValueEntry {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,35 +143,35 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("addr", "is_external", "name")); + openapiFields = new HashSet(Arrays.asList("name", "value")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("addr", "is_external", "name")); + openapiRequiredFields = new HashSet(Arrays.asList("name", "value")); } /** * 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 AIDecompInverseFunctionMapItem + * @throws IOException if the JSON Element is invalid with respect to DataTypeEnumValueEntry */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!AIDecompInverseFunctionMapItem.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 AIDecompInverseFunctionMapItem is not found in the empty JSON string", AIDecompInverseFunctionMapItem.openapiRequiredFields.toString())); + if (!DataTypeEnumValueEntry.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 DataTypeEnumValueEntry is not found in the empty JSON string", DataTypeEnumValueEntry.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!AIDecompInverseFunctionMapItem.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AIDecompInverseFunctionMapItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!DataTypeEnumValueEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataTypeEnumValueEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AIDecompInverseFunctionMapItem.openapiRequiredFields) { + for (String requiredField : DataTypeEnumValueEntry.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())); } @@ -206,28 +180,31 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti 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())); } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!AIDecompInverseFunctionMapItem.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AIDecompInverseFunctionMapItem' and its subtypes + if (!DataTypeEnumValueEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DataTypeEnumValueEntry' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AIDecompInverseFunctionMapItem.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DataTypeEnumValueEntry.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, AIDecompInverseFunctionMapItem value) throws IOException { + public void write(JsonWriter out, DataTypeEnumValueEntry value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public AIDecompInverseFunctionMapItem read(JsonReader in) throws IOException { + public DataTypeEnumValueEntry read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -238,18 +215,18 @@ public AIDecompInverseFunctionMapItem read(JsonReader in) throws IOException { } /** - * Create an instance of AIDecompInverseFunctionMapItem given an JSON string + * Create an instance of DataTypeEnumValueEntry given an JSON string * * @param jsonString JSON string - * @return An instance of AIDecompInverseFunctionMapItem - * @throws IOException if the JSON string is invalid with respect to AIDecompInverseFunctionMapItem + * @return An instance of DataTypeEnumValueEntry + * @throws IOException if the JSON string is invalid with respect to DataTypeEnumValueEntry */ - public static AIDecompInverseFunctionMapItem fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AIDecompInverseFunctionMapItem.class); + public static DataTypeEnumValueEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DataTypeEnumValueEntry.class); } /** - * Convert an instance of AIDecompInverseFunctionMapItem to an JSON string + * Convert an instance of DataTypeEnumValueEntry to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/DataTypesEntry.java b/src/main/java/ai/reveng/model/DataTypeFunctionEntry.java similarity index 59% rename from src/main/java/ai/reveng/model/DataTypesEntry.java rename to src/main/java/ai/reveng/model/DataTypeFunctionEntry.java index a00c345f..8501b6dd 100644 --- a/src/main/java/ai/reveng/model/DataTypesEntry.java +++ b/src/main/java/ai/reveng/model/DataTypeFunctionEntry.java @@ -13,7 +13,6 @@ package ai.reveng.model; import java.util.Objects; -import ai.reveng.model.FunctionInfo; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -46,82 +45,58 @@ import ai.reveng.invoker.JSON; /** - * DataTypesEntry + * DataTypeFunctionEntry */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class DataTypesEntry { - public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES) - @javax.annotation.Nullable - private FunctionInfo dataTypes; - - public static final String SERIALIZED_NAME_DATA_TYPES_VERSION = "data_types_version"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_VERSION) - @javax.annotation.Nonnull - private Long dataTypesVersion; - +public class DataTypeFunctionEntry { public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; @SerializedName(SERIALIZED_NAME_FUNCTION_ID) @javax.annotation.Nonnull private Long functionId; - public DataTypesEntry() { - } - - public DataTypesEntry dataTypes(@javax.annotation.Nullable FunctionInfo dataTypes) { - this.dataTypes = dataTypes; - return this; - } - - /** - * Get dataTypes - * @return dataTypes - */ - @javax.annotation.Nullable - public FunctionInfo getDataTypes() { - return dataTypes; - } + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; - public void setDataTypes(@javax.annotation.Nullable FunctionInfo dataTypes) { - this.dataTypes = dataTypes; + public DataTypeFunctionEntry() { } - - public DataTypesEntry dataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; + public DataTypeFunctionEntry functionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; return this; } /** - * Current version of the function data types. Pass this back on the next write to satisfy the CAS check. - * @return dataTypesVersion + * Get functionId + * @return functionId */ @javax.annotation.Nonnull - public Long getDataTypesVersion() { - return dataTypesVersion; + public Long getFunctionId() { + return functionId; } - public void setDataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; + public void setFunctionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; } - public DataTypesEntry functionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; + public DataTypeFunctionEntry functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; return this; } /** - * Get functionId - * @return functionId + * Current name of the function. + * @return functionName */ @javax.annotation.Nonnull - public Long getFunctionId() { - return functionId; + public String getFunctionName() { + return functionName; } - public void setFunctionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; } @@ -134,24 +109,22 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - DataTypesEntry dataTypesEntry = (DataTypesEntry) o; - return Objects.equals(this.dataTypes, dataTypesEntry.dataTypes) && - Objects.equals(this.dataTypesVersion, dataTypesEntry.dataTypesVersion) && - Objects.equals(this.functionId, dataTypesEntry.functionId); + DataTypeFunctionEntry dataTypeFunctionEntry = (DataTypeFunctionEntry) o; + return Objects.equals(this.functionId, dataTypeFunctionEntry.functionId) && + Objects.equals(this.functionName, dataTypeFunctionEntry.functionName); } @Override public int hashCode() { - return Objects.hash(dataTypes, dataTypesVersion, functionId); + return Objects.hash(functionId, functionName); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class DataTypesEntry {\n"); - sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); - sb.append(" dataTypesVersion: ").append(toIndentedString(dataTypesVersion)).append("\n"); + sb.append("class DataTypeFunctionEntry {\n"); sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); sb.append("}"); return sb.toString(); } @@ -170,43 +143,42 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("data_types", "data_types_version", "function_id")); + openapiFields = new HashSet(Arrays.asList("function_id", "function_name")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("data_types_version", "function_id")); + openapiRequiredFields = new HashSet(Arrays.asList("function_id", "function_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 DataTypesEntry + * @throws IOException if the JSON Element is invalid with respect to DataTypeFunctionEntry */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!DataTypesEntry.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 DataTypesEntry is not found in the empty JSON string", DataTypesEntry.openapiRequiredFields.toString())); + if (!DataTypeFunctionEntry.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 DataTypeFunctionEntry is not found in the empty JSON string", DataTypeFunctionEntry.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!DataTypesEntry.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataTypesEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!DataTypeFunctionEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataTypeFunctionEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DataTypesEntry.openapiRequiredFields) { + for (String requiredField : DataTypeFunctionEntry.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(); - // validate the optional field `data_types` - if (jsonObj.get("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { - FunctionInfo.validateJsonElement(jsonObj.get("data_types")); + if (!jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); } } @@ -214,22 +186,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!DataTypesEntry.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DataTypesEntry' and its subtypes + if (!DataTypeFunctionEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DataTypeFunctionEntry' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(DataTypesEntry.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DataTypeFunctionEntry.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, DataTypesEntry value) throws IOException { + public void write(JsonWriter out, DataTypeFunctionEntry value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public DataTypesEntry read(JsonReader in) throws IOException { + public DataTypeFunctionEntry read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -240,18 +212,18 @@ public DataTypesEntry read(JsonReader in) throws IOException { } /** - * Create an instance of DataTypesEntry given an JSON string + * Create an instance of DataTypeFunctionEntry given an JSON string * * @param jsonString JSON string - * @return An instance of DataTypesEntry - * @throws IOException if the JSON string is invalid with respect to DataTypesEntry + * @return An instance of DataTypeFunctionEntry + * @throws IOException if the JSON string is invalid with respect to DataTypeFunctionEntry */ - public static DataTypesEntry fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DataTypesEntry.class); + public static DataTypeFunctionEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DataTypeFunctionEntry.class); } /** - * Convert an instance of DataTypesEntry to an JSON string + * Convert an instance of DataTypeFunctionEntry to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/DataTypeFunctionParameterEntry.java b/src/main/java/ai/reveng/model/DataTypeFunctionParameterEntry.java new file mode 100644 index 00000000..4258dad5 --- /dev/null +++ b/src/main/java/ai/reveng/model/DataTypeFunctionParameterEntry.java @@ -0,0 +1,286 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * DataTypeFunctionParameterEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DataTypeFunctionParameterEntry { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long dataTypeId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ORDINAL = "ordinal"; + @SerializedName(SERIALIZED_NAME_ORDINAL) + @javax.annotation.Nonnull + private Long ordinal; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nonnull + private Long size; + + public DataTypeFunctionParameterEntry() { + } + + public DataTypeFunctionParameterEntry dataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The parameter's type. + * @return dataTypeId + */ + @javax.annotation.Nullable + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public DataTypeFunctionParameterEntry name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Parameter name, when the producer had one. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public DataTypeFunctionParameterEntry ordinal(@javax.annotation.Nonnull Long ordinal) { + this.ordinal = ordinal; + return this; + } + + /** + * Zero-based argument position. + * @return ordinal + */ + @javax.annotation.Nonnull + public Long getOrdinal() { + return ordinal; + } + + public void setOrdinal(@javax.annotation.Nonnull Long ordinal) { + this.ordinal = ordinal; + } + + + public DataTypeFunctionParameterEntry size(@javax.annotation.Nonnull Long size) { + this.size = size; + return this; + } + + /** + * Parameter size in bytes. + * @return size + */ + @javax.annotation.Nonnull + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nonnull Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DataTypeFunctionParameterEntry dataTypeFunctionParameterEntry = (DataTypeFunctionParameterEntry) o; + return Objects.equals(this.dataTypeId, dataTypeFunctionParameterEntry.dataTypeId) && + Objects.equals(this.name, dataTypeFunctionParameterEntry.name) && + Objects.equals(this.ordinal, dataTypeFunctionParameterEntry.ordinal) && + Objects.equals(this.size, dataTypeFunctionParameterEntry.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, name, ordinal, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DataTypeFunctionParameterEntry {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ordinal: ").append(toIndentedString(ordinal)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "name", "ordinal", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("ordinal", "size")); + } + + /** + * 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 DataTypeFunctionParameterEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DataTypeFunctionParameterEntry.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 DataTypeFunctionParameterEntry is not found in the empty JSON string", DataTypeFunctionParameterEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DataTypeFunctionParameterEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataTypeFunctionParameterEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DataTypeFunctionParameterEntry.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") != null && !jsonObj.get("name").isJsonNull()) && !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 (!DataTypeFunctionParameterEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DataTypeFunctionParameterEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DataTypeFunctionParameterEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DataTypeFunctionParameterEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DataTypeFunctionParameterEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DataTypeFunctionParameterEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of DataTypeFunctionParameterEntry + * @throws IOException if the JSON string is invalid with respect to DataTypeFunctionParameterEntry + */ + public static DataTypeFunctionParameterEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DataTypeFunctionParameterEntry.class); + } + + /** + * Convert an instance of DataTypeFunctionParameterEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StackVariable.java b/src/main/java/ai/reveng/model/DataTypeMemberEntry.java similarity index 62% rename from src/main/java/ai/reveng/model/StackVariable.java rename to src/main/java/ai/reveng/model/DataTypeMemberEntry.java index 22793bf2..f243ca32 100644 --- a/src/main/java/ai/reveng/model/StackVariable.java +++ b/src/main/java/ai/reveng/model/DataTypeMemberEntry.java @@ -20,7 +20,6 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -46,154 +45,178 @@ import ai.reveng.invoker.JSON; /** - * StackVariable + * DataTypeMemberEntry */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class StackVariable { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) +public class DataTypeMemberEntry { + public static final String SERIALIZED_NAME_BIT_OFFSET = "bit_offset"; + @SerializedName(SERIALIZED_NAME_BIT_OFFSET) @javax.annotation.Nullable - private String lastChange; + private Long bitOffset; - public static final String SERIALIZED_NAME_OFFSET = "offset"; - @SerializedName(SERIALIZED_NAME_OFFSET) + public static final String SERIALIZED_NAME_BIT_SIZE = "bit_size"; + @SerializedName(SERIALIZED_NAME_BIT_SIZE) + @javax.annotation.Nullable + private Long bitSize; + + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long dataTypeId; + + public static final String SERIALIZED_NAME_IS_BITFIELD = "is_bitfield"; + @SerializedName(SERIALIZED_NAME_IS_BITFIELD) @javax.annotation.Nonnull - private Integer offset; + private Boolean isBitfield; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull + @javax.annotation.Nullable private String name; - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) + public static final String SERIALIZED_NAME_OFFSET = "offset"; + @SerializedName(SERIALIZED_NAME_OFFSET) @javax.annotation.Nonnull - private String type; + private Long offset; public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) @javax.annotation.Nonnull - private Integer size; + private Long size; - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nonnull - private Integer addr; + public DataTypeMemberEntry() { + } + + public DataTypeMemberEntry bitOffset(@javax.annotation.Nullable Long bitOffset) { + this.bitOffset = bitOffset; + return this; + } - public StackVariable() { + /** + * Bit offset from the start of the containing type, for bitfields. + * @return bitOffset + */ + @javax.annotation.Nullable + public Long getBitOffset() { + return bitOffset; + } + + public void setBitOffset(@javax.annotation.Nullable Long bitOffset) { + this.bitOffset = bitOffset; } - public StackVariable lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; + + public DataTypeMemberEntry bitSize(@javax.annotation.Nullable Long bitSize) { + this.bitSize = bitSize; return this; } /** - * Timestamp of the last change to this stack variable - * @return lastChange + * Width in bits, for bitfields. + * @return bitSize */ @javax.annotation.Nullable - public String getLastChange() { - return lastChange; + public Long getBitSize() { + return bitSize; } - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; + public void setBitSize(@javax.annotation.Nullable Long bitSize) { + this.bitSize = bitSize; } - public StackVariable offset(@javax.annotation.Nonnull Integer offset) { - this.offset = offset; + public DataTypeMemberEntry dataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; return this; } /** - * Offset of the stack variable - * @return offset + * The member's type. + * @return dataTypeId */ - @javax.annotation.Nonnull - public Integer getOffset() { - return offset; + @javax.annotation.Nullable + public Long getDataTypeId() { + return dataTypeId; } - public void setOffset(@javax.annotation.Nonnull Integer offset) { - this.offset = offset; + public void setDataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; } - public StackVariable name(@javax.annotation.Nonnull String name) { - this.name = name; + public DataTypeMemberEntry isBitfield(@javax.annotation.Nonnull Boolean isBitfield) { + this.isBitfield = isBitfield; return this; } /** - * Name of the stack variable - * @return name + * Whether this member is a bitfield. + * @return isBitfield */ @javax.annotation.Nonnull - public String getName() { - return name; + public Boolean getIsBitfield() { + return isBitfield; } - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; + public void setIsBitfield(@javax.annotation.Nonnull Boolean isBitfield) { + this.isBitfield = isBitfield; } - public StackVariable type(@javax.annotation.Nonnull String type) { - this.type = type; + public DataTypeMemberEntry name(@javax.annotation.Nullable String name) { + this.name = name; return this; } /** - * Data type of the stack variable - * @return type + * Member name, absent for unnamed padding. + * @return name */ - @javax.annotation.Nonnull - public String getType() { - return type; + @javax.annotation.Nullable + public String getName() { + return name; } - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; + public void setName(@javax.annotation.Nullable String name) { + this.name = name; } - public StackVariable size(@javax.annotation.Nonnull Integer size) { - this.size = size; + public DataTypeMemberEntry offset(@javax.annotation.Nonnull Long offset) { + this.offset = offset; return this; } /** - * Size of the stack variable in bytes - * @return size + * Byte offset from the start of the containing type. + * @return offset */ @javax.annotation.Nonnull - public Integer getSize() { - return size; + public Long getOffset() { + return offset; } - public void setSize(@javax.annotation.Nonnull Integer size) { - this.size = size; + public void setOffset(@javax.annotation.Nonnull Long offset) { + this.offset = offset; } - public StackVariable addr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; + public DataTypeMemberEntry size(@javax.annotation.Nonnull Long size) { + this.size = size; return this; } /** - * Memory address of the stack variable - * @return addr + * Member size in bytes. + * @return size */ @javax.annotation.Nonnull - public Integer getAddr() { - return addr; + public Long getSize() { + return size; } - public void setAddr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; + public void setSize(@javax.annotation.Nonnull Long size) { + this.size = size; } /** @@ -209,9 +232,9 @@ public void setAddr(@javax.annotation.Nonnull Integer addr) { * * @param key name of the property * @param value value of the property - * @return the StackVariable instance itself + * @return the DataTypeMemberEntry instance itself */ - public StackVariable putAdditionalProperty(String key, Object value) { + public DataTypeMemberEntry putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -250,42 +273,33 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - StackVariable stackVariable = (StackVariable) o; - return Objects.equals(this.lastChange, stackVariable.lastChange) && - Objects.equals(this.offset, stackVariable.offset) && - Objects.equals(this.name, stackVariable.name) && - Objects.equals(this.type, stackVariable.type) && - Objects.equals(this.size, stackVariable.size) && - Objects.equals(this.addr, stackVariable.addr)&& - Objects.equals(this.additionalProperties, stackVariable.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + DataTypeMemberEntry dataTypeMemberEntry = (DataTypeMemberEntry) o; + return Objects.equals(this.bitOffset, dataTypeMemberEntry.bitOffset) && + Objects.equals(this.bitSize, dataTypeMemberEntry.bitSize) && + Objects.equals(this.dataTypeId, dataTypeMemberEntry.dataTypeId) && + Objects.equals(this.isBitfield, dataTypeMemberEntry.isBitfield) && + Objects.equals(this.name, dataTypeMemberEntry.name) && + Objects.equals(this.offset, dataTypeMemberEntry.offset) && + Objects.equals(this.size, dataTypeMemberEntry.size)&& + Objects.equals(this.additionalProperties, dataTypeMemberEntry.additionalProperties); } @Override public int hashCode() { - return Objects.hash(lastChange, offset, name, type, size, addr, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + return Objects.hash(bitOffset, bitSize, dataTypeId, isBitfield, name, offset, size, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class StackVariable {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append("class DataTypeMemberEntry {\n"); + sb.append(" bitOffset: ").append(toIndentedString(bitOffset)).append("\n"); + sb.append(" bitSize: ").append(toIndentedString(bitSize)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" isBitfield: ").append(toIndentedString(isBitfield)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -305,57 +319,51 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("last_change", "offset", "name", "type", "size", "addr")); + openapiFields = new HashSet(Arrays.asList("bit_offset", "bit_size", "data_type_id", "is_bitfield", "name", "offset", "size")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("offset", "name", "type", "size", "addr")); + openapiRequiredFields = new HashSet(Arrays.asList("is_bitfield", "offset", "size")); } /** * 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 StackVariable + * @throws IOException if the JSON Element is invalid with respect to DataTypeMemberEntry */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!StackVariable.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 StackVariable is not found in the empty JSON string", StackVariable.openapiRequiredFields.toString())); + if (!DataTypeMemberEntry.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 DataTypeMemberEntry is not found in the empty JSON string", DataTypeMemberEntry.openapiRequiredFields.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : StackVariable.openapiRequiredFields) { + for (String requiredField : DataTypeMemberEntry.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - if (!jsonObj.get("name").isJsonPrimitive()) { + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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())); } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!StackVariable.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'StackVariable' and its subtypes + if (!DataTypeMemberEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DataTypeMemberEntry' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(StackVariable.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DataTypeMemberEntry.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, StackVariable value) throws IOException { + public void write(JsonWriter out, DataTypeMemberEntry value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -383,12 +391,12 @@ else if (entry.getValue() instanceof Character) } @Override - public StackVariable read(JsonReader in) throws IOException { + public DataTypeMemberEntry read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - StackVariable instance = thisAdapter.fromJsonTree(jsonObj); + DataTypeMemberEntry instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -415,18 +423,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of StackVariable given an JSON string + * Create an instance of DataTypeMemberEntry given an JSON string * * @param jsonString JSON string - * @return An instance of StackVariable - * @throws IOException if the JSON string is invalid with respect to StackVariable + * @return An instance of DataTypeMemberEntry + * @throws IOException if the JSON string is invalid with respect to DataTypeMemberEntry */ - public static StackVariable fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, StackVariable.class); + public static DataTypeMemberEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DataTypeMemberEntry.class); } /** - * Convert an instance of StackVariable to an JSON string + * Convert an instance of DataTypeMemberEntry to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/DataTypeVersion.java b/src/main/java/ai/reveng/model/DataTypeVersion.java new file mode 100644 index 00000000..5c7b66f8 --- /dev/null +++ b/src/main/java/ai/reveng/model/DataTypeVersion.java @@ -0,0 +1,266 @@ +/* + * 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.DataTypeEntry; +import ai.reveng.model.HistoryActor; +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; + +/** + * DataTypeVersion + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class DataTypeVersion { + public static final String SERIALIZED_NAME_UPDATED_AT = "updated_at"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updated_by"; + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + @javax.annotation.Nullable + private HistoryActor updatedBy; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private DataTypeEntry value; + + public DataTypeVersion() { + } + + public DataTypeVersion updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * When this version was written. Absent on a version that predates the recorded history. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public DataTypeVersion updatedBy(@javax.annotation.Nullable HistoryActor updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * Who wrote this version. Absent on a version that predates the recorded history. + * @return updatedBy + */ + @javax.annotation.Nullable + public HistoryActor getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(@javax.annotation.Nullable HistoryActor updatedBy) { + this.updatedBy = updatedBy; + } + + + public DataTypeVersion value(@javax.annotation.Nonnull DataTypeEntry value) { + this.value = value; + return this; + } + + /** + * The type as it stood in this version. + * @return value + */ + @javax.annotation.Nonnull + public DataTypeEntry getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull DataTypeEntry value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DataTypeVersion dataTypeVersion = (DataTypeVersion) o; + return Objects.equals(this.updatedAt, dataTypeVersion.updatedAt) && + Objects.equals(this.updatedBy, dataTypeVersion.updatedBy) && + Objects.equals(this.value, dataTypeVersion.value); + } + + @Override + public int hashCode() { + return Objects.hash(updatedAt, updatedBy, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DataTypeVersion {\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("updated_at", "updated_by", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value")); + } + + /** + * 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 DataTypeVersion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DataTypeVersion.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 DataTypeVersion is not found in the empty JSON string", DataTypeVersion.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DataTypeVersion.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `DataTypeVersion` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DataTypeVersion.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(); + // validate the optional field `updated_by` + if (jsonObj.get("updated_by") != null && !jsonObj.get("updated_by").isJsonNull()) { + HistoryActor.validateJsonElement(jsonObj.get("updated_by")); + } + // validate the required field `value` + DataTypeEntry.validateJsonElement(jsonObj.get("value")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DataTypeVersion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DataTypeVersion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DataTypeVersion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DataTypeVersion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DataTypeVersion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DataTypeVersion given an JSON string + * + * @param jsonString JSON string + * @return An instance of DataTypeVersion + * @throws IOException if the JSON string is invalid with respect to DataTypeVersion + */ + public static DataTypeVersion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DataTypeVersion.class); + } + + /** + * Convert an instance of DataTypeVersion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/DisassemblyOutputBody.java b/src/main/java/ai/reveng/model/DisassemblyOutputBody.java index e725db49..e6b5f4ff 100644 --- a/src/main/java/ai/reveng/model/DisassemblyOutputBody.java +++ b/src/main/java/ai/reveng/model/DisassemblyOutputBody.java @@ -60,6 +60,11 @@ public class DisassemblyOutputBody { @javax.annotation.Nonnull private Long functionId; + public static final String SERIALIZED_NAME_GLOBAL_VARIABLES = "global_variables"; + @SerializedName(SERIALIZED_NAME_GLOBAL_VARIABLES) + @javax.annotation.Nullable + private Object globalVariables = null; + public static final String SERIALIZED_NAME_LOCAL_VARIABLES = "local_variables"; @SerializedName(SERIALIZED_NAME_LOCAL_VARIABLES) @javax.annotation.Nullable @@ -121,6 +126,25 @@ public void setFunctionId(@javax.annotation.Nonnull Long functionId) { } + public DisassemblyOutputBody globalVariables(@javax.annotation.Nullable Object globalVariables) { + this.globalVariables = globalVariables; + return this; + } + + /** + * Get globalVariables + * @return globalVariables + */ + @javax.annotation.Nullable + public Object getGlobalVariables() { + return globalVariables; + } + + public void setGlobalVariables(@javax.annotation.Nullable Object globalVariables) { + this.globalVariables = globalVariables; + } + + public DisassemblyOutputBody localVariables(@javax.annotation.Nullable Object localVariables) { this.localVariables = localVariables; return this; @@ -253,6 +277,7 @@ public boolean equals(Object o) { DisassemblyOutputBody disassemblyOutputBody = (DisassemblyOutputBody) o; return Objects.equals(this.basicBlocks, disassemblyOutputBody.basicBlocks) && Objects.equals(this.functionId, disassemblyOutputBody.functionId) && + Objects.equals(this.globalVariables, disassemblyOutputBody.globalVariables) && Objects.equals(this.localVariables, disassemblyOutputBody.localVariables) && Objects.equals(this.params, disassemblyOutputBody.params) && Objects.equals(this.returnType, disassemblyOutputBody.returnType) && @@ -266,7 +291,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(basicBlocks, functionId, localVariables, params, returnType, returns, additionalProperties); + return Objects.hash(basicBlocks, functionId, globalVariables, localVariables, params, returnType, returns, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -282,6 +307,7 @@ public String toString() { sb.append("class DisassemblyOutputBody {\n"); sb.append(" basicBlocks: ").append(toIndentedString(basicBlocks)).append("\n"); sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" globalVariables: ").append(toIndentedString(globalVariables)).append("\n"); sb.append(" localVariables: ").append(toIndentedString(localVariables)).append("\n"); sb.append(" params: ").append(toIndentedString(params)).append("\n"); sb.append(" returnType: ").append(toIndentedString(returnType)).append("\n"); @@ -305,7 +331,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("basic_blocks", "function_id", "local_variables", "params", "return_type", "returns")); + openapiFields = new HashSet(Arrays.asList("basic_blocks", "function_id", "global_variables", "local_variables", "params", "return_type", "returns")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("function_id", "returns")); diff --git a/src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java b/src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java index 868ae8f5..aeaa0ed7 100644 --- a/src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java +++ b/src/main/java/ai/reveng/model/DynamicExecutionStatusResponse.java @@ -153,7 +153,7 @@ public DynamicExecutionStatusResponse logs(@javax.annotation.Nonnull AnalysisLog } /** - * Sandbox status log messages captured during the run. Contains a single \"No logs available\" message when none have been captured yet. + * Sandbox status log messages captured during the run. Empty when none have been captured yet. * @return logs */ @javax.annotation.Nonnull diff --git a/src/main/java/ai/reveng/model/EnumDataType.java b/src/main/java/ai/reveng/model/EnumDataType.java new file mode 100644 index 00000000..4e75cd59 --- /dev/null +++ b/src/main/java/ai/reveng/model/EnumDataType.java @@ -0,0 +1,571 @@ +/* + * 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.EnumDefinition; +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; + +/** + * EnumDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EnumDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private EnumDefinition definition; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + ENUM("ENUM"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public EnumDataType() { + } + + public EnumDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public EnumDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public EnumDataType definition(@javax.annotation.Nullable EnumDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Absent only for a type referenced but never defined. + * @return definition + */ + @javax.annotation.Nullable + public EnumDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable EnumDefinition definition) { + this.definition = definition; + } + + + public EnumDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public EnumDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public EnumDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public EnumDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public EnumDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public EnumDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public EnumDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumDataType enumDataType = (EnumDataType) o; + return Objects.equals(this.createdAt, enumDataType.createdAt) && + Objects.equals(this.dataTypeId, enumDataType.dataTypeId) && + Objects.equals(this.definition, enumDataType.definition) && + Objects.equals(this.hasDefinition, enumDataType.hasDefinition) && + Objects.equals(this.kind, enumDataType.kind) && + Objects.equals(this.name, enumDataType.name) && + Objects.equals(this.namespace, enumDataType.namespace) && + Objects.equals(this.size, enumDataType.size) && + Objects.equals(this.sourceFunctionId, enumDataType.sourceFunctionId) && + Objects.equals(this.sourceType, enumDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, definition, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "definition", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnumDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumDataType.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 EnumDataType is not found in the empty JSON string", EnumDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EnumDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `EnumDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EnumDataType.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(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + EnumDefinition.validateJsonElement(jsonObj.get("definition")); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EnumDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumDataType + * @throws IOException if the JSON string is invalid with respect to EnumDataType + */ + public static EnumDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumDataType.class); + } + + /** + * Convert an instance of EnumDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/EnumDefinition.java b/src/main/java/ai/reveng/model/EnumDefinition.java new file mode 100644 index 00000000..77a81a12 --- /dev/null +++ b/src/main/java/ai/reveng/model/EnumDefinition.java @@ -0,0 +1,226 @@ +/* + * 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.DataTypeEnumValueEntry; +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; + +/** + * EnumDefinition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EnumDefinition { + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + @javax.annotation.Nullable + private List values; + + public EnumDefinition() { + } + + public EnumDefinition values(@javax.annotation.Nullable List values) { + this.values = values; + return this; + } + + public EnumDefinition addValuesItem(DataTypeEnumValueEntry valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * The type's constants. + * @return values + */ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + public void setValues(@javax.annotation.Nullable List values) { + this.values = values; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumDefinition enumDefinition = (EnumDefinition) o; + return Objects.equals(this.values, enumDefinition.values); + } + + @Override + public int hashCode() { + return Objects.hash(values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumDefinition {\n"); + sb.append(" values: ").append(toIndentedString(values)).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("values")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("values")); + } + + /** + * 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 EnumDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnumDefinition.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 EnumDefinition is not found in the empty JSON string", EnumDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EnumDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `EnumDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EnumDefinition.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("values") != null && !jsonObj.get("values").isJsonNull()) { + if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + JsonArray jsonArrayvalues = jsonObj.getAsJsonArray("values"); + // validate the required field `values` (array) + for (int i = 0; i < jsonArrayvalues.size(); i++) { + DataTypeEnumValueEntry.validateJsonElement(jsonArrayvalues.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnumDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnumDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnumDefinition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnumDefinition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EnumDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnumDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnumDefinition + * @throws IOException if the JSON string is invalid with respect to EnumDefinition + */ + public static EnumDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnumDefinition.class); + } + + /** + * Convert an instance of EnumDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Enumeration.java b/src/main/java/ai/reveng/model/Enumeration.java deleted file mode 100644 index ee910d7f..00000000 --- a/src/main/java/ai/reveng/model/Enumeration.java +++ /dev/null @@ -1,395 +0,0 @@ -/* - * 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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * Enumeration - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Enumeration { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_MEMBERS = "members"; - @SerializedName(SERIALIZED_NAME_MEMBERS) - @javax.annotation.Nonnull - private Map members = new HashMap<>(); - - public static final String SERIALIZED_NAME_ARTIFACT_TYPE = "artifact_type"; - @SerializedName(SERIALIZED_NAME_ARTIFACT_TYPE) - @javax.annotation.Nullable - private String artifactType; - - public Enumeration() { - } - - public Enumeration lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this enumeration - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public Enumeration name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the enumeration - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public Enumeration members(@javax.annotation.Nonnull Map members) { - this.members = members; - return this; - } - - public Enumeration putMembersItem(String key, Integer membersItem) { - if (this.members == null) { - this.members = new HashMap<>(); - } - this.members.put(key, membersItem); - return this; - } - - /** - * Dictionary of enumeration members and their values - * @return members - */ - @javax.annotation.Nonnull - public Map getMembers() { - return members; - } - - public void setMembers(@javax.annotation.Nonnull Map members) { - this.members = members; - } - - - public Enumeration artifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - return this; - } - - /** - * Type of artifact that the enumeration is associated with - * @return artifactType - */ - @javax.annotation.Nullable - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - } - - /** - * 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 Enumeration instance itself - */ - public Enumeration 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; - } - Enumeration enumeration = (Enumeration) o; - return Objects.equals(this.lastChange, enumeration.lastChange) && - Objects.equals(this.name, enumeration.name) && - Objects.equals(this.members, enumeration.members) && - Objects.equals(this.artifactType, enumeration.artifactType)&& - Objects.equals(this.additionalProperties, enumeration.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, name, members, artifactType, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Enumeration {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" members: ").append(toIndentedString(members)).append("\n"); - sb.append(" artifactType: ").append(toIndentedString(artifactType)).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("last_change", "name", "members", "artifact_type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "members")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Enumeration - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Enumeration.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 Enumeration is not found in the empty JSON string", Enumeration.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Enumeration.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if ((jsonObj.get("artifact_type") != null && !jsonObj.get("artifact_type").isJsonNull()) && !jsonObj.get("artifact_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `artifact_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("artifact_type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Enumeration.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Enumeration' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Enumeration.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Enumeration 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 Enumeration read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Enumeration 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 Enumeration given an JSON string - * - * @param jsonString JSON string - * @return An instance of Enumeration - * @throws IOException if the JSON string is invalid with respect to Enumeration - */ - public static Enumeration fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Enumeration.class); - } - - /** - * Convert an instance of Enumeration to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FuncDepsInner.java b/src/main/java/ai/reveng/model/FuncDepsInner.java deleted file mode 100644 index 3bd67734..00000000 --- a/src/main/java/ai/reveng/model/FuncDepsInner.java +++ /dev/null @@ -1,360 +0,0 @@ -/* - * 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.Enumeration; -import ai.reveng.model.GlobalVariable; -import ai.reveng.model.Structure; -import ai.reveng.model.TypeDefinition; -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 java.io.IOException; -import java.lang.reflect.Type; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.JsonPrimitive; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonArray; -import com.google.gson.JsonParseException; - -import ai.reveng.invoker.JSON; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FuncDepsInner extends AbstractOpenApiSchema { - private static final Logger log = Logger.getLogger(FuncDepsInner.class.getName()); - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FuncDepsInner.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FuncDepsInner' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter adapterStructure = gson.getDelegateAdapter(this, TypeToken.get(Structure.class)); - final TypeAdapter adapterEnumeration = gson.getDelegateAdapter(this, TypeToken.get(Enumeration.class)); - final TypeAdapter adapterTypeDefinition = gson.getDelegateAdapter(this, TypeToken.get(TypeDefinition.class)); - final TypeAdapter adapterGlobalVariable = gson.getDelegateAdapter(this, TypeToken.get(GlobalVariable.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FuncDepsInner value) throws IOException { - if (value == null || value.getActualInstance() == null) { - elementAdapter.write(out, null); - return; - } - - // check if the actual instance is of the type `Structure` - if (value.getActualInstance() instanceof Structure) { - JsonElement element = adapterStructure.toJsonTree((Structure)value.getActualInstance()); - elementAdapter.write(out, element); - return; - } - // check if the actual instance is of the type `Enumeration` - if (value.getActualInstance() instanceof Enumeration) { - JsonElement element = adapterEnumeration.toJsonTree((Enumeration)value.getActualInstance()); - elementAdapter.write(out, element); - return; - } - // check if the actual instance is of the type `TypeDefinition` - if (value.getActualInstance() instanceof TypeDefinition) { - JsonElement element = adapterTypeDefinition.toJsonTree((TypeDefinition)value.getActualInstance()); - elementAdapter.write(out, element); - return; - } - // check if the actual instance is of the type `GlobalVariable` - if (value.getActualInstance() instanceof GlobalVariable) { - JsonElement element = adapterGlobalVariable.toJsonTree((GlobalVariable)value.getActualInstance()); - elementAdapter.write(out, element); - return; - } - throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Enumeration, GlobalVariable, Structure, TypeDefinition"); - } - - @Override - public FuncDepsInner read(JsonReader in) throws IOException { - Object deserialized = null; - JsonElement jsonElement = elementAdapter.read(in); - - ArrayList errorMessages = new ArrayList<>(); - TypeAdapter actualAdapter = elementAdapter; - - // deserialize Structure - try { - // validate the JSON object to see if any exception is thrown - Structure.validateJsonElement(jsonElement); - actualAdapter = adapterStructure; - FuncDepsInner ret = new FuncDepsInner(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for Structure failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'Structure'", e); - } - // deserialize Enumeration - try { - // validate the JSON object to see if any exception is thrown - Enumeration.validateJsonElement(jsonElement); - actualAdapter = adapterEnumeration; - FuncDepsInner ret = new FuncDepsInner(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for Enumeration failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'Enumeration'", e); - } - // deserialize TypeDefinition - try { - // validate the JSON object to see if any exception is thrown - TypeDefinition.validateJsonElement(jsonElement); - actualAdapter = adapterTypeDefinition; - FuncDepsInner ret = new FuncDepsInner(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for TypeDefinition failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'TypeDefinition'", e); - } - // deserialize GlobalVariable - try { - // validate the JSON object to see if any exception is thrown - GlobalVariable.validateJsonElement(jsonElement); - actualAdapter = adapterGlobalVariable; - FuncDepsInner ret = new FuncDepsInner(); - ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); - return ret; - } catch (Exception e) { - // deserialization failed, continue - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for GlobalVariable failed with `%s`.", e.getMessage())); - log.log(Level.FINER, "Input data does not match schema 'GlobalVariable'", e); - } - - throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for FuncDepsInner: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); - } - }.nullSafe(); - } - } - - // store a list of schema names defined in anyOf - public static final Map> schemas = new HashMap>(); - - public FuncDepsInner() { - super("anyOf", Boolean.FALSE); - } - - public FuncDepsInner(Object o) { - super("anyOf", Boolean.FALSE); - setActualInstance(o); - } - - static { - schemas.put("Structure", Structure.class); - schemas.put("Enumeration", Enumeration.class); - schemas.put("TypeDefinition", TypeDefinition.class); - schemas.put("GlobalVariable", GlobalVariable.class); - } - - @Override - public Map> getSchemas() { - return FuncDepsInner.schemas; - } - - /** - * Set the instance that matches the anyOf child schema, check - * the instance parameter is valid against the anyOf child schemas: - * Enumeration, GlobalVariable, Structure, TypeDefinition - * - * It could be an instance of the 'anyOf' schemas. - */ - @Override - public void setActualInstance(Object instance) { - if (instance instanceof Structure) { - super.setActualInstance(instance); - return; - } - - if (instance instanceof Enumeration) { - super.setActualInstance(instance); - return; - } - - if (instance instanceof TypeDefinition) { - super.setActualInstance(instance); - return; - } - - if (instance instanceof GlobalVariable) { - super.setActualInstance(instance); - return; - } - - throw new RuntimeException("Invalid instance type. Must be Enumeration, GlobalVariable, Structure, TypeDefinition"); - } - - /** - * Get the actual instance, which can be the following: - * Enumeration, GlobalVariable, Structure, TypeDefinition - * - * @return The actual instance (Enumeration, GlobalVariable, Structure, TypeDefinition) - */ - @SuppressWarnings("unchecked") - @Override - public Object getActualInstance() { - return super.getActualInstance(); - } - - /** - * Get the actual instance of `Structure`. If the actual instance is not `Structure`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `Structure` - * @throws ClassCastException if the instance is not `Structure` - */ - public Structure getStructure() throws ClassCastException { - return (Structure)super.getActualInstance(); - } - - /** - * Get the actual instance of `Enumeration`. If the actual instance is not `Enumeration`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `Enumeration` - * @throws ClassCastException if the instance is not `Enumeration` - */ - public Enumeration getEnumeration() throws ClassCastException { - return (Enumeration)super.getActualInstance(); - } - - /** - * Get the actual instance of `TypeDefinition`. If the actual instance is not `TypeDefinition`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `TypeDefinition` - * @throws ClassCastException if the instance is not `TypeDefinition` - */ - public TypeDefinition getTypeDefinition() throws ClassCastException { - return (TypeDefinition)super.getActualInstance(); - } - - /** - * Get the actual instance of `GlobalVariable`. If the actual instance is not `GlobalVariable`, - * the ClassCastException will be thrown. - * - * @return The actual instance of `GlobalVariable` - * @throws ClassCastException if the instance is not `GlobalVariable` - */ - public GlobalVariable getGlobalVariable() throws ClassCastException { - return (GlobalVariable)super.getActualInstance(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to FuncDepsInner - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - // validate anyOf schemas one by one - ArrayList errorMessages = new ArrayList<>(); - // validate the json string with Structure - try { - Structure.validateJsonElement(jsonElement); - return; - } catch (Exception e) { - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for Structure failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with Enumeration - try { - Enumeration.validateJsonElement(jsonElement); - return; - } catch (Exception e) { - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for Enumeration failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with TypeDefinition - try { - TypeDefinition.validateJsonElement(jsonElement); - return; - } catch (Exception e) { - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for TypeDefinition failed with `%s`.", e.getMessage())); - // continue to the next one - } - // validate the json string with GlobalVariable - try { - GlobalVariable.validateJsonElement(jsonElement); - return; - } catch (Exception e) { - errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for GlobalVariable failed with `%s`.", e.getMessage())); - // continue to the next one - } - throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for FuncDepsInner with anyOf schemas: Enumeration, GlobalVariable, Structure, TypeDefinition. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); - } - - /** - * Create an instance of FuncDepsInner given an JSON string - * - * @param jsonString JSON string - * @return An instance of FuncDepsInner - * @throws IOException if the JSON string is invalid with respect to FuncDepsInner - */ - public static FuncDepsInner fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FuncDepsInner.class); - } - - /** - * Convert an instance of FuncDepsInner to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionDataType.java b/src/main/java/ai/reveng/model/FunctionDataType.java new file mode 100644 index 00000000..bf243d14 --- /dev/null +++ b/src/main/java/ai/reveng/model/FunctionDataType.java @@ -0,0 +1,571 @@ +/* + * 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.FunctionTypeDefinition; +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; + +/** + * FunctionDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FunctionDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private FunctionTypeDefinition definition; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + FUNCTION_DEFINITION("FUNCTION_DEFINITION"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public FunctionDataType() { + } + + public FunctionDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public FunctionDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public FunctionDataType definition(@javax.annotation.Nullable FunctionTypeDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Absent only for a type referenced but never defined. + * @return definition + */ + @javax.annotation.Nullable + public FunctionTypeDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable FunctionTypeDefinition definition) { + this.definition = definition; + } + + + public FunctionDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public FunctionDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public FunctionDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public FunctionDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public FunctionDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public FunctionDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public FunctionDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FunctionDataType functionDataType = (FunctionDataType) o; + return Objects.equals(this.createdAt, functionDataType.createdAt) && + Objects.equals(this.dataTypeId, functionDataType.dataTypeId) && + Objects.equals(this.definition, functionDataType.definition) && + Objects.equals(this.hasDefinition, functionDataType.hasDefinition) && + Objects.equals(this.kind, functionDataType.kind) && + Objects.equals(this.name, functionDataType.name) && + Objects.equals(this.namespace, functionDataType.namespace) && + Objects.equals(this.size, functionDataType.size) && + Objects.equals(this.sourceFunctionId, functionDataType.sourceFunctionId) && + Objects.equals(this.sourceType, functionDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, definition, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "definition", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FunctionDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionDataType.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 FunctionDataType is not found in the empty JSON string", FunctionDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FunctionDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionDataType.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(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + FunctionTypeDefinition.validateJsonElement(jsonObj.get("definition")); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FunctionDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FunctionDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FunctionDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionDataType + * @throws IOException if the JSON string is invalid with respect to FunctionDataType + */ + public static FunctionDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionDataType.class); + } + + /** + * Convert an instance of FunctionDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionDataTypes.java b/src/main/java/ai/reveng/model/FunctionDataTypes.java deleted file mode 100644 index 82a545f7..00000000 --- a/src/main/java/ai/reveng/model/FunctionDataTypes.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * 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.V2FunctionInfo; -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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * FunctionDataTypes - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionDataTypes { - public static final String SERIALIZED_NAME_COMPLETED = "completed"; - @SerializedName(SERIALIZED_NAME_COMPLETED) - @javax.annotation.Nonnull - private Boolean completed; - - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nonnull - private String status; - - public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES) - @javax.annotation.Nullable - private V2FunctionInfo dataTypes; - - public static final String SERIALIZED_NAME_DATA_TYPES_VERSION = "data_types_version"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_VERSION) - @javax.annotation.Nullable - private Integer dataTypesVersion; - - public FunctionDataTypes() { - } - - public FunctionDataTypes completed(@javax.annotation.Nonnull Boolean completed) { - this.completed = completed; - return this; - } - - /** - * Whether the service has completed data types generation - * @return completed - */ - @javax.annotation.Nonnull - public Boolean getCompleted() { - return completed; - } - - public void setCompleted(@javax.annotation.Nonnull Boolean completed) { - this.completed = completed; - } - - - public FunctionDataTypes status(@javax.annotation.Nonnull String status) { - this.status = status; - return this; - } - - /** - * The current status of the data types service - * @return status - */ - @javax.annotation.Nonnull - public String getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nonnull String status) { - this.status = status; - } - - - public FunctionDataTypes dataTypes(@javax.annotation.Nullable V2FunctionInfo dataTypes) { - this.dataTypes = dataTypes; - return this; - } - - /** - * Function data types information if available - * @return dataTypes - */ - @javax.annotation.Nullable - public V2FunctionInfo getDataTypes() { - return dataTypes; - } - - public void setDataTypes(@javax.annotation.Nullable V2FunctionInfo dataTypes) { - this.dataTypes = dataTypes; - } - - - public FunctionDataTypes dataTypesVersion(@javax.annotation.Nullable Integer dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - return this; - } - - /** - * If the data types information has been updated by the user, this field will be populated - * @return dataTypesVersion - */ - @javax.annotation.Nullable - public Integer getDataTypesVersion() { - return dataTypesVersion; - } - - public void setDataTypesVersion(@javax.annotation.Nullable Integer dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - } - - /** - * 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 FunctionDataTypes instance itself - */ - public FunctionDataTypes 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; - } - FunctionDataTypes functionDataTypes = (FunctionDataTypes) o; - return Objects.equals(this.completed, functionDataTypes.completed) && - Objects.equals(this.status, functionDataTypes.status) && - Objects.equals(this.dataTypes, functionDataTypes.dataTypes) && - Objects.equals(this.dataTypesVersion, functionDataTypes.dataTypesVersion)&& - Objects.equals(this.additionalProperties, functionDataTypes.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(completed, status, dataTypes, dataTypesVersion, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionDataTypes {\n"); - sb.append(" completed: ").append(toIndentedString(completed)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); - sb.append(" dataTypesVersion: ").append(toIndentedString(dataTypesVersion)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - return o == null ? "null" : o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("completed", "status", "data_types", "data_types_version")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("completed", "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 FunctionDataTypes - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionDataTypes.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 FunctionDataTypes is not found in the empty JSON string", FunctionDataTypes.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionDataTypes.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 optional field `data_types` - if (jsonObj.get("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { - V2FunctionInfo.validateJsonElement(jsonObj.get("data_types")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionDataTypes.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionDataTypes' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionDataTypes.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionDataTypes 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 FunctionDataTypes read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - FunctionDataTypes 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 FunctionDataTypes given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionDataTypes - * @throws IOException if the JSON string is invalid with respect to FunctionDataTypes - */ - public static FunctionDataTypes fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionDataTypes.class); - } - - /** - * Convert an instance of FunctionDataTypes to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionDataTypesList.java b/src/main/java/ai/reveng/model/FunctionDataTypesList.java deleted file mode 100644 index db96206e..00000000 --- a/src/main/java/ai/reveng/model/FunctionDataTypesList.java +++ /dev/null @@ -1,359 +0,0 @@ -/* - * 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.FunctionDataTypesListItem; -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; - -/** - * FunctionDataTypesList - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionDataTypesList { - public static final String SERIALIZED_NAME_TOTAL_COUNT = "total_count"; - @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) - @javax.annotation.Nullable - private Integer totalCount = 0; - - public static final String SERIALIZED_NAME_TOTAL_DATA_TYPES_COUNT = "total_data_types_count"; - @SerializedName(SERIALIZED_NAME_TOTAL_DATA_TYPES_COUNT) - @javax.annotation.Nullable - private Integer totalDataTypesCount = 0; - - public static final String SERIALIZED_NAME_ITEMS = "items"; - @SerializedName(SERIALIZED_NAME_ITEMS) - @javax.annotation.Nonnull - private List items = new ArrayList<>(); - - public FunctionDataTypesList() { - } - - public FunctionDataTypesList totalCount(@javax.annotation.Nullable Integer totalCount) { - this.totalCount = totalCount; - return this; - } - - /** - * Total number of functions in analysis - * @return totalCount - */ - @javax.annotation.Nullable - public Integer getTotalCount() { - return totalCount; - } - - public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { - this.totalCount = totalCount; - } - - - public FunctionDataTypesList totalDataTypesCount(@javax.annotation.Nullable Integer totalDataTypesCount) { - this.totalDataTypesCount = totalDataTypesCount; - return this; - } - - /** - * Total number of functions with data types - * @return totalDataTypesCount - */ - @javax.annotation.Nullable - public Integer getTotalDataTypesCount() { - return totalDataTypesCount; - } - - public void setTotalDataTypesCount(@javax.annotation.Nullable Integer totalDataTypesCount) { - this.totalDataTypesCount = totalDataTypesCount; - } - - - public FunctionDataTypesList items(@javax.annotation.Nonnull List items) { - this.items = items; - return this; - } - - public FunctionDataTypesList addItemsItem(FunctionDataTypesListItem itemsItem) { - if (this.items == null) { - this.items = new ArrayList<>(); - } - this.items.add(itemsItem); - return this; - } - - /** - * List of function data types information - * @return items - */ - @javax.annotation.Nonnull - public List getItems() { - return items; - } - - public void setItems(@javax.annotation.Nonnull List items) { - this.items = items; - } - - /** - * 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 FunctionDataTypesList instance itself - */ - public FunctionDataTypesList 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; - } - FunctionDataTypesList functionDataTypesList = (FunctionDataTypesList) o; - return Objects.equals(this.totalCount, functionDataTypesList.totalCount) && - Objects.equals(this.totalDataTypesCount, functionDataTypesList.totalDataTypesCount) && - Objects.equals(this.items, functionDataTypesList.items)&& - Objects.equals(this.additionalProperties, functionDataTypesList.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(totalCount, totalDataTypesCount, items, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionDataTypesList {\n"); - sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); - sb.append(" totalDataTypesCount: ").append(toIndentedString(totalDataTypesCount)).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).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("total_count", "total_data_types_count", "items")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("items")); - } - - /** - * 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 FunctionDataTypesList - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionDataTypesList.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 FunctionDataTypesList is not found in the empty JSON string", FunctionDataTypesList.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionDataTypesList.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("items") != null) { - if (!jsonObj.get("items").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); - } - JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); - // validate the required field `items` (array) - for (int i = 0; i < jsonArrayitems.size(); i++) { - FunctionDataTypesListItem.validateJsonElement(jsonArrayitems.get(i)); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionDataTypesList.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionDataTypesList' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionDataTypesList.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionDataTypesList 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 FunctionDataTypesList read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - FunctionDataTypesList 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 FunctionDataTypesList given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionDataTypesList - * @throws IOException if the JSON string is invalid with respect to FunctionDataTypesList - */ - public static FunctionDataTypesList fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionDataTypesList.class); - } - - /** - * Convert an instance of FunctionDataTypesList to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionDataTypesListItem.java b/src/main/java/ai/reveng/model/FunctionDataTypesListItem.java deleted file mode 100644 index 23b8977d..00000000 --- a/src/main/java/ai/reveng/model/FunctionDataTypesListItem.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * 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.V2FunctionInfo; -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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * FunctionDataTypesListItem - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionDataTypesListItem { - public static final String SERIALIZED_NAME_COMPLETED = "completed"; - @SerializedName(SERIALIZED_NAME_COMPLETED) - @javax.annotation.Nonnull - private Boolean completed; - - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nonnull - private String status; - - public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES) - @javax.annotation.Nullable - private V2FunctionInfo dataTypes; - - public static final String SERIALIZED_NAME_DATA_TYPES_VERSION = "data_types_version"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_VERSION) - @javax.annotation.Nullable - private Integer dataTypesVersion; - - public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; - @SerializedName(SERIALIZED_NAME_FUNCTION_ID) - @javax.annotation.Nonnull - private Long functionId; - - public FunctionDataTypesListItem() { - } - - public FunctionDataTypesListItem completed(@javax.annotation.Nonnull Boolean completed) { - this.completed = completed; - return this; - } - - /** - * Whether the service has completed data types generation - * @return completed - */ - @javax.annotation.Nonnull - public Boolean getCompleted() { - return completed; - } - - public void setCompleted(@javax.annotation.Nonnull Boolean completed) { - this.completed = completed; - } - - - public FunctionDataTypesListItem status(@javax.annotation.Nonnull String status) { - this.status = status; - return this; - } - - /** - * The current status of the data types service - * @return status - */ - @javax.annotation.Nonnull - public String getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nonnull String status) { - this.status = status; - } - - - public FunctionDataTypesListItem dataTypes(@javax.annotation.Nullable V2FunctionInfo dataTypes) { - this.dataTypes = dataTypes; - return this; - } - - /** - * Function data types information if available - * @return dataTypes - */ - @javax.annotation.Nullable - public V2FunctionInfo getDataTypes() { - return dataTypes; - } - - public void setDataTypes(@javax.annotation.Nullable V2FunctionInfo dataTypes) { - this.dataTypes = dataTypes; - } - - - public FunctionDataTypesListItem dataTypesVersion(@javax.annotation.Nullable Integer dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - return this; - } - - /** - * If the data types information has been updated by the user, this field will be populated - * @return dataTypesVersion - */ - @javax.annotation.Nullable - public Integer getDataTypesVersion() { - return dataTypesVersion; - } - - public void setDataTypesVersion(@javax.annotation.Nullable Integer dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - } - - - public FunctionDataTypesListItem functionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - return this; - } - - /** - * Function id - * @return functionId - */ - @javax.annotation.Nonnull - public Long getFunctionId() { - return functionId; - } - - public void setFunctionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - } - - /** - * 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 FunctionDataTypesListItem instance itself - */ - public FunctionDataTypesListItem 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; - } - FunctionDataTypesListItem functionDataTypesListItem = (FunctionDataTypesListItem) o; - return Objects.equals(this.completed, functionDataTypesListItem.completed) && - Objects.equals(this.status, functionDataTypesListItem.status) && - Objects.equals(this.dataTypes, functionDataTypesListItem.dataTypes) && - Objects.equals(this.dataTypesVersion, functionDataTypesListItem.dataTypesVersion) && - Objects.equals(this.functionId, functionDataTypesListItem.functionId)&& - Objects.equals(this.additionalProperties, functionDataTypesListItem.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(completed, status, dataTypes, dataTypesVersion, functionId, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionDataTypesListItem {\n"); - sb.append(" completed: ").append(toIndentedString(completed)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); - sb.append(" dataTypesVersion: ").append(toIndentedString(dataTypesVersion)).append("\n"); - sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - return o == null ? "null" : o.toString().replace("\n", "\n "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("completed", "status", "data_types", "data_types_version", "function_id")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("completed", "status", "function_id")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to FunctionDataTypesListItem - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionDataTypesListItem.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 FunctionDataTypesListItem is not found in the empty JSON string", FunctionDataTypesListItem.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionDataTypesListItem.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 optional field `data_types` - if (jsonObj.get("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { - V2FunctionInfo.validateJsonElement(jsonObj.get("data_types")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionDataTypesListItem.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionDataTypesListItem' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionDataTypesListItem.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionDataTypesListItem 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 FunctionDataTypesListItem read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - FunctionDataTypesListItem 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 FunctionDataTypesListItem given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionDataTypesListItem - * @throws IOException if the JSON string is invalid with respect to FunctionDataTypesListItem - */ - public static FunctionDataTypesListItem fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionDataTypesListItem.class); - } - - /** - * Convert an instance of FunctionDataTypesListItem to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionDataTypesParams.java b/src/main/java/ai/reveng/model/FunctionDataTypesParams.java deleted file mode 100644 index af99b78a..00000000 --- a/src/main/java/ai/reveng/model/FunctionDataTypesParams.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * RevEng.AI API - * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package ai.reveng.model; - -import java.util.Objects; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * FunctionDataTypesParams - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionDataTypesParams { - public static final String SERIALIZED_NAME_FUNCTION_IDS = "function_ids"; - @SerializedName(SERIALIZED_NAME_FUNCTION_IDS) - @javax.annotation.Nonnull - private List functionIds = new ArrayList<>(); - - public FunctionDataTypesParams() { - } - - public FunctionDataTypesParams functionIds(@javax.annotation.Nonnull List functionIds) { - this.functionIds = functionIds; - return this; - } - - public FunctionDataTypesParams addFunctionIdsItem(Long functionIdsItem) { - if (this.functionIds == null) { - this.functionIds = new ArrayList<>(); - } - this.functionIds.add(functionIdsItem); - return this; - } - - /** - * The function ID's to generate/get data types for - * @return functionIds - */ - @javax.annotation.Nonnull - public List getFunctionIds() { - return functionIds; - } - - public void setFunctionIds(@javax.annotation.Nonnull List functionIds) { - this.functionIds = functionIds; - } - - /** - * 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 FunctionDataTypesParams instance itself - */ - public FunctionDataTypesParams 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; - } - FunctionDataTypesParams functionDataTypesParams = (FunctionDataTypesParams) o; - return Objects.equals(this.functionIds, functionDataTypesParams.functionIds)&& - Objects.equals(this.additionalProperties, functionDataTypesParams.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(functionIds, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionDataTypesParams {\n"); - sb.append(" functionIds: ").append(toIndentedString(functionIds)).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_ids")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("function_ids")); - } - - /** - * 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 FunctionDataTypesParams - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionDataTypesParams.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 FunctionDataTypesParams is not found in the empty JSON string", FunctionDataTypesParams.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionDataTypesParams.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("function_ids") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("function_ids").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_ids` to be an array in the JSON string but got `%s`", jsonObj.get("function_ids").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionDataTypesParams.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionDataTypesParams' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionDataTypesParams.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionDataTypesParams 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 FunctionDataTypesParams read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - FunctionDataTypesParams 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 FunctionDataTypesParams given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionDataTypesParams - * @throws IOException if the JSON string is invalid with respect to FunctionDataTypesParams - */ - public static FunctionDataTypesParams fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionDataTypesParams.class); - } - - /** - * Convert an instance of FunctionDataTypesParams to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionDataTypesStatus.java b/src/main/java/ai/reveng/model/FunctionDataTypesStatus.java deleted file mode 100644 index 12e8d9c5..00000000 --- a/src/main/java/ai/reveng/model/FunctionDataTypesStatus.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * 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; - -/** - * FunctionDataTypesStatus - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionDataTypesStatus { - public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; - @SerializedName(SERIALIZED_NAME_FUNCTION_ID) - @javax.annotation.Nonnull - private Long functionId; - - public static final String SERIALIZED_NAME_COMPLETED = "completed"; - @SerializedName(SERIALIZED_NAME_COMPLETED) - @javax.annotation.Nonnull - private Boolean completed; - - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nonnull - private String status; - - public FunctionDataTypesStatus() { - } - - public FunctionDataTypesStatus functionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - return this; - } - - /** - * Function id - * @return functionId - */ - @javax.annotation.Nonnull - public Long getFunctionId() { - return functionId; - } - - public void setFunctionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - } - - - public FunctionDataTypesStatus completed(@javax.annotation.Nonnull Boolean completed) { - this.completed = completed; - return this; - } - - /** - * Whether the service has completed data types generation - * @return completed - */ - @javax.annotation.Nonnull - public Boolean getCompleted() { - return completed; - } - - public void setCompleted(@javax.annotation.Nonnull Boolean completed) { - this.completed = completed; - } - - - public FunctionDataTypesStatus status(@javax.annotation.Nonnull String status) { - this.status = status; - return this; - } - - /** - * The current status of the data types service - * @return status - */ - @javax.annotation.Nonnull - public String getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nonnull String 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 FunctionDataTypesStatus instance itself - */ - public FunctionDataTypesStatus 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; - } - FunctionDataTypesStatus functionDataTypesStatus = (FunctionDataTypesStatus) o; - return Objects.equals(this.functionId, functionDataTypesStatus.functionId) && - Objects.equals(this.completed, functionDataTypesStatus.completed) && - Objects.equals(this.status, functionDataTypesStatus.status)&& - Objects.equals(this.additionalProperties, functionDataTypesStatus.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(functionId, completed, status, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionDataTypesStatus {\n"); - sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); - sb.append(" completed: ").append(toIndentedString(completed)).append("\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("function_id", "completed", "status")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("function_id", "completed", "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 FunctionDataTypesStatus - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionDataTypesStatus.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 FunctionDataTypesStatus is not found in the empty JSON string", FunctionDataTypesStatus.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionDataTypesStatus.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())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionDataTypesStatus.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionDataTypesStatus' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionDataTypesStatus.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionDataTypesStatus 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 FunctionDataTypesStatus read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - FunctionDataTypesStatus 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 FunctionDataTypesStatus given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionDataTypesStatus - * @throws IOException if the JSON string is invalid with respect to FunctionDataTypesStatus - */ - public static FunctionDataTypesStatus fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionDataTypesStatus.class); - } - - /** - * Convert an instance of FunctionDataTypesStatus to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionDependency.java b/src/main/java/ai/reveng/model/FunctionDependency.java deleted file mode 100644 index d2bcf3ce..00000000 --- a/src/main/java/ai/reveng/model/FunctionDependency.java +++ /dev/null @@ -1,414 +0,0 @@ -/* - * 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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * FunctionDependency - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionDependency { - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nullable - private Long addr; - - public static final String SERIALIZED_NAME_ARTIFACT_TYPE = "artifact_type"; - @SerializedName(SERIALIZED_NAME_ARTIFACT_TYPE) - @javax.annotation.Nullable - private String artifactType; - - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_MEMBERS = "members"; - @SerializedName(SERIALIZED_NAME_MEMBERS) - @javax.annotation.Nullable - private Object members = null; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_SCOPE = "scope"; - @SerializedName(SERIALIZED_NAME_SCOPE) - @javax.annotation.Nullable - private String scope; - - public static final String SERIALIZED_NAME_SIZE = "size"; - @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nullable - private Long size; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nullable - private String type; - - public FunctionDependency() { - } - - public FunctionDependency addr(@javax.annotation.Nullable Long addr) { - this.addr = addr; - return this; - } - - /** - * Memory address (GlobalVariable). - * @return addr - */ - @javax.annotation.Nullable - public Long getAddr() { - return addr; - } - - public void setAddr(@javax.annotation.Nullable Long addr) { - this.addr = addr; - } - - - public FunctionDependency artifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - return this; - } - - /** - * Get artifactType - * @return artifactType - */ - @javax.annotation.Nullable - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - } - - - public FunctionDependency lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Get lastChange - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public FunctionDependency members(@javax.annotation.Nullable Object members) { - this.members = members; - return this; - } - - /** - * Get members - * @return members - */ - @javax.annotation.Nullable - public Object getMembers() { - return members; - } - - public void setMembers(@javax.annotation.Nullable Object members) { - this.members = members; - } - - - public FunctionDependency name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public FunctionDependency scope(@javax.annotation.Nullable String scope) { - this.scope = scope; - return this; - } - - /** - * Get scope - * @return scope - */ - @javax.annotation.Nullable - public String getScope() { - return scope; - } - - public void setScope(@javax.annotation.Nullable String scope) { - this.scope = scope; - } - - - public FunctionDependency size(@javax.annotation.Nullable Long size) { - this.size = size; - return this; - } - - /** - * Total byte size (Struct, GlobalVariable). - * @return size - */ - @javax.annotation.Nullable - public Long getSize() { - return size; - } - - public void setSize(@javax.annotation.Nullable Long size) { - this.size = size; - } - - - public FunctionDependency type(@javax.annotation.Nullable String type) { - this.type = type; - return this; - } - - /** - * Underlying type (TypeDefinition, GlobalVariable). - * @return type - */ - @javax.annotation.Nullable - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nullable String type) { - this.type = type; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FunctionDependency functionDependency = (FunctionDependency) o; - return Objects.equals(this.addr, functionDependency.addr) && - Objects.equals(this.artifactType, functionDependency.artifactType) && - Objects.equals(this.lastChange, functionDependency.lastChange) && - Objects.equals(this.members, functionDependency.members) && - Objects.equals(this.name, functionDependency.name) && - Objects.equals(this.scope, functionDependency.scope) && - Objects.equals(this.size, functionDependency.size) && - Objects.equals(this.type, functionDependency.type); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(addr, artifactType, lastChange, members, name, scope, size, type); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionDependency {\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" artifactType: ").append(toIndentedString(artifactType)).append("\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" members: ").append(toIndentedString(members)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).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("addr", "artifact_type", "last_change", "members", "name", "scope", "size", "type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("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 FunctionDependency - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionDependency.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 FunctionDependency is not found in the empty JSON string", FunctionDependency.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FunctionDependency.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionDependency` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionDependency.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("artifact_type") != null && !jsonObj.get("artifact_type").isJsonNull()) && !jsonObj.get("artifact_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `artifact_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("artifact_type").toString())); - } - if ((jsonObj.get("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); - } - if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionDependency.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionDependency' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionDependency.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionDependency value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FunctionDependency read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of FunctionDependency given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionDependency - * @throws IOException if the JSON string is invalid with respect to FunctionDependency - */ - public static FunctionDependency fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionDependency.class); - } - - /** - * Convert an instance of FunctionDependency to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionHeader.java b/src/main/java/ai/reveng/model/FunctionHeader.java deleted file mode 100644 index 28864afc..00000000 --- a/src/main/java/ai/reveng/model/FunctionHeader.java +++ /dev/null @@ -1,358 +0,0 @@ -/* - * 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.FunctionArgument; -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; - -/** - * FunctionHeader - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionHeader { - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nonnull - private Long addr; - - public static final String SERIALIZED_NAME_ARGS = "args"; - @SerializedName(SERIALIZED_NAME_ARGS) - @javax.annotation.Nonnull - private Map args = new HashMap<>(); - - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_SCOPE = "scope"; - @SerializedName(SERIALIZED_NAME_SCOPE) - @javax.annotation.Nullable - private String scope; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public FunctionHeader() { - } - - public FunctionHeader addr(@javax.annotation.Nonnull Long addr) { - this.addr = addr; - return this; - } - - /** - * Get addr - * @return addr - */ - @javax.annotation.Nonnull - public Long getAddr() { - return addr; - } - - public void setAddr(@javax.annotation.Nonnull Long addr) { - this.addr = addr; - } - - - public FunctionHeader args(@javax.annotation.Nonnull Map args) { - this.args = args; - return this; - } - - public FunctionHeader putArgsItem(String key, FunctionArgument argsItem) { - if (this.args == null) { - this.args = new HashMap<>(); - } - this.args.put(key, argsItem); - return this; - } - - /** - * Argument map keyed by ordinal hex (e.g. \"0x0\", \"0x1\"). - * @return args - */ - @javax.annotation.Nonnull - public Map getArgs() { - return args; - } - - public void setArgs(@javax.annotation.Nonnull Map args) { - this.args = args; - } - - - public FunctionHeader lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Get lastChange - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public FunctionHeader name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public FunctionHeader scope(@javax.annotation.Nullable String scope) { - this.scope = scope; - return this; - } - - /** - * Get scope - * @return scope - */ - @javax.annotation.Nullable - public String getScope() { - return scope; - } - - public void setScope(@javax.annotation.Nullable String scope) { - this.scope = scope; - } - - - public FunctionHeader type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FunctionHeader functionHeader = (FunctionHeader) o; - return Objects.equals(this.addr, functionHeader.addr) && - Objects.equals(this.args, functionHeader.args) && - Objects.equals(this.lastChange, functionHeader.lastChange) && - Objects.equals(this.name, functionHeader.name) && - Objects.equals(this.scope, functionHeader.scope) && - Objects.equals(this.type, functionHeader.type); - } - - @Override - public int hashCode() { - return Objects.hash(addr, args, lastChange, name, scope, type); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionHeader {\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" args: ").append(toIndentedString(args)).append("\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).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("addr", "args", "last_change", "name", "scope", "type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("addr", "args", "name", "type")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to FunctionHeader - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionHeader.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 FunctionHeader is not found in the empty JSON string", FunctionHeader.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FunctionHeader.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionHeader` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionHeader.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionHeader.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionHeader' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionHeader.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionHeader value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FunctionHeader read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of FunctionHeader given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionHeader - * @throws IOException if the JSON string is invalid with respect to FunctionHeader - */ - public static FunctionHeader fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionHeader.class); - } - - /** - * Convert an instance of FunctionHeader to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionRename.java b/src/main/java/ai/reveng/model/FunctionRename.java index 91470007..e165fd04 100644 --- a/src/main/java/ai/reveng/model/FunctionRename.java +++ b/src/main/java/ai/reveng/model/FunctionRename.java @@ -13,6 +13,7 @@ package ai.reveng.model; import java.util.Objects; +import ai.reveng.model.FunctionSourceType; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -59,6 +60,11 @@ public class FunctionRename { @javax.annotation.Nonnull private String newMangledName; + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nullable + private FunctionSourceType sourceType = FunctionSourceType.USER; + public FunctionRename() { } @@ -99,6 +105,25 @@ public void setNewMangledName(@javax.annotation.Nonnull String newMangledName) { this.newMangledName = newMangledName; } + + public FunctionRename sourceType(@javax.annotation.Nullable FunctionSourceType sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * The source that triggered the rename + * @return sourceType + */ + @javax.annotation.Nullable + public FunctionSourceType getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nullable FunctionSourceType sourceType) { + this.sourceType = sourceType; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -155,13 +180,14 @@ public boolean equals(Object o) { } FunctionRename functionRename = (FunctionRename) o; return Objects.equals(this.newName, functionRename.newName) && - Objects.equals(this.newMangledName, functionRename.newMangledName)&& + Objects.equals(this.newMangledName, functionRename.newMangledName) && + Objects.equals(this.sourceType, functionRename.sourceType)&& Objects.equals(this.additionalProperties, functionRename.additionalProperties); } @Override public int hashCode() { - return Objects.hash(newName, newMangledName, additionalProperties); + return Objects.hash(newName, newMangledName, sourceType, additionalProperties); } @Override @@ -170,6 +196,7 @@ public String toString() { sb.append("class FunctionRename {\n"); sb.append(" newName: ").append(toIndentedString(newName)).append("\n"); sb.append(" newMangledName: ").append(toIndentedString(newMangledName)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -189,7 +216,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("new_name", "new_mangled_name")); + openapiFields = new HashSet(Arrays.asList("new_name", "new_mangled_name", "source_type")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("new_name", "new_mangled_name")); @@ -221,6 +248,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("new_mangled_name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `new_mangled_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("new_mangled_name").toString())); } + // validate the optional field `source_type` + if (jsonObj.get("source_type") != null && !jsonObj.get("source_type").isJsonNull()) { + FunctionSourceType.validateJsonElement(jsonObj.get("source_type")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/ai/reveng/model/FunctionSignatureBody.java b/src/main/java/ai/reveng/model/FunctionSignatureBody.java new file mode 100644 index 00000000..ed1e5e3c --- /dev/null +++ b/src/main/java/ai/reveng/model/FunctionSignatureBody.java @@ -0,0 +1,646 @@ +/* + * 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.DataTypeEntry; +import ai.reveng.model.SignatureParameterEntry; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * FunctionSignatureBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FunctionSignatureBody { + public static final String SERIALIZED_NAME_CALLING_CONVENTION = "calling_convention"; + @SerializedName(SERIALIZED_NAME_CALLING_CONVENTION) + @javax.annotation.Nullable + private String callingConvention; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; + @SerializedName(SERIALIZED_NAME_DATA_TYPES) + @javax.annotation.Nullable + private List dataTypes; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nonnull + private Long functionId; + + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; + + public static final String SERIALIZED_NAME_HAS_SIGNATURE = "has_signature"; + @SerializedName(SERIALIZED_NAME_HAS_SIGNATURE) + @javax.annotation.Nonnull + private Boolean hasSignature; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters; + + public static final String SERIALIZED_NAME_RETURN_DATA_TYPE_ID = "return_data_type_id"; + @SerializedName(SERIALIZED_NAME_RETURN_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long returnDataTypeId; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this signature came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nullable + private SourceTypeEnum sourceType; + + public FunctionSignatureBody() { + } + + public FunctionSignatureBody callingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + return this; + } + + /** + * Calling convention, when the producer reported one. + * @return callingConvention + */ + @javax.annotation.Nullable + public String getCallingConvention() { + return callingConvention; + } + + public void setCallingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + } + + + public FunctionSignatureBody createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this signature was extracted. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public FunctionSignatureBody dataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + public FunctionSignatureBody addDataTypesItem(DataTypeEntry dataTypesItem) { + if (this.dataTypes == null) { + this.dataTypes = new ArrayList<>(); + } + this.dataTypes.add(dataTypesItem); + return this; + } + + /** + * The types the signature names — its parameter types and its return type — ordered by data_type_id. Each entry is identical to the one the data types endpoints serve for that id. Returned only when include_data_types is true. + * @return dataTypes + */ + @javax.annotation.Nullable + public List getDataTypes() { + return dataTypes; + } + + public void setDataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + } + + + public FunctionSignatureBody functionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + return this; + } + + /** + * Get functionId + * @return functionId + */ + @javax.annotation.Nonnull + public Long getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + } + + + public FunctionSignatureBody functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Current name of the function. + * @return functionName + */ + @javax.annotation.Nonnull + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + } + + + public FunctionSignatureBody hasSignature(@javax.annotation.Nonnull Boolean hasSignature) { + this.hasSignature = hasSignature; + return this; + } + + /** + * Whether a signature was extracted for this function. False is a normal result: no signature is recorded unless data type extraction ran for the analysis, and thunks and external functions are skipped when it does. + * @return hasSignature + */ + @javax.annotation.Nonnull + public Boolean getHasSignature() { + return hasSignature; + } + + public void setHasSignature(@javax.annotation.Nonnull Boolean hasSignature) { + this.hasSignature = hasSignature; + } + + + public FunctionSignatureBody parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public FunctionSignatureBody addParametersItem(SignatureParameterEntry parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Parameters in argument order. Empty with has_signature true means the function is known to take no arguments. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public FunctionSignatureBody returnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + return this; + } + + /** + * Return type, resolvable against the analysis data types list. Absent for an unresolved return type. + * @return returnDataTypeId + */ + @javax.annotation.Nullable + public Long getReturnDataTypeId() { + return returnDataTypeId; + } + + public void setReturnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + } + + + public FunctionSignatureBody sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this signature was copied from, when it was transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public FunctionSignatureBody sourceType(@javax.annotation.Nullable SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this signature came from. + * @return sourceType + */ + @javax.annotation.Nullable + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nullable SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + /** + * 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 FunctionSignatureBody instance itself + */ + public FunctionSignatureBody 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; + } + FunctionSignatureBody functionSignatureBody = (FunctionSignatureBody) o; + return Objects.equals(this.callingConvention, functionSignatureBody.callingConvention) && + Objects.equals(this.createdAt, functionSignatureBody.createdAt) && + Objects.equals(this.dataTypes, functionSignatureBody.dataTypes) && + Objects.equals(this.functionId, functionSignatureBody.functionId) && + Objects.equals(this.functionName, functionSignatureBody.functionName) && + Objects.equals(this.hasSignature, functionSignatureBody.hasSignature) && + Objects.equals(this.parameters, functionSignatureBody.parameters) && + Objects.equals(this.returnDataTypeId, functionSignatureBody.returnDataTypeId) && + Objects.equals(this.sourceFunctionId, functionSignatureBody.sourceFunctionId) && + Objects.equals(this.sourceType, functionSignatureBody.sourceType)&& + Objects.equals(this.additionalProperties, functionSignatureBody.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(callingConvention, createdAt, dataTypes, functionId, functionName, hasSignature, parameters, returnDataTypeId, sourceFunctionId, sourceType, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionSignatureBody {\n"); + sb.append(" callingConvention: ").append(toIndentedString(callingConvention)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); + sb.append(" hasSignature: ").append(toIndentedString(hasSignature)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" returnDataTypeId: ").append(toIndentedString(returnDataTypeId)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).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("calling_convention", "created_at", "data_types", "function_id", "function_name", "has_signature", "parameters", "return_data_type_id", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("function_id", "function_name", "has_signature", "parameters")); + } + + /** + * 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 FunctionSignatureBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionSignatureBody.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 FunctionSignatureBody is not found in the empty JSON string", FunctionSignatureBody.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionSignatureBody.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("calling_convention") != null && !jsonObj.get("calling_convention").isJsonNull()) && !jsonObj.get("calling_convention").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `calling_convention` to be a primitive type in the JSON string but got `%s`", jsonObj.get("calling_convention").toString())); + } + if (jsonObj.get("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { + JsonArray jsonArraydataTypes = jsonObj.getAsJsonArray("data_types"); + if (jsonArraydataTypes != null) { + // ensure the json data is an array + if (!jsonObj.get("data_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data_types` to be an array in the JSON string but got `%s`", jsonObj.get("data_types").toString())); + } + + // validate the optional field `data_types` (array) + for (int i = 0; i < jsonArraydataTypes.size(); i++) { + DataTypeEntry.validateJsonElement(jsonArraydataTypes.get(i)); + }; + } + } + if (!jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + SignatureParameterEntry.validateJsonElement(jsonArrayparameters.get(i)); + } + } + if ((jsonObj.get("source_type") != null && !jsonObj.get("source_type").isJsonNull()) && !jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the optional field `source_type` + if (jsonObj.get("source_type") != null && !jsonObj.get("source_type").isJsonNull()) { + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionSignatureBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionSignatureBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FunctionSignatureBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionSignatureBody 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 FunctionSignatureBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FunctionSignatureBody 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 FunctionSignatureBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionSignatureBody + * @throws IOException if the JSON string is invalid with respect to FunctionSignatureBody + */ + public static FunctionSignatureBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionSignatureBody.class); + } + + /** + * Convert an instance of FunctionSignatureBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionSignatureEntry.java b/src/main/java/ai/reveng/model/FunctionSignatureEntry.java new file mode 100644 index 00000000..ecb005a6 --- /dev/null +++ b/src/main/java/ai/reveng/model/FunctionSignatureEntry.java @@ -0,0 +1,504 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import ai.reveng.model.SignatureParameterEntry; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * FunctionSignatureEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FunctionSignatureEntry { + public static final String SERIALIZED_NAME_CALLING_CONVENTION = "calling_convention"; + @SerializedName(SERIALIZED_NAME_CALLING_CONVENTION) + @javax.annotation.Nullable + private String callingConvention; + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nonnull + private Long functionId; + + public static final String SERIALIZED_NAME_FUNCTION_NAME = "function_name"; + @SerializedName(SERIALIZED_NAME_FUNCTION_NAME) + @javax.annotation.Nonnull + private String functionName; + + public static final String SERIALIZED_NAME_HAS_SIGNATURE = "has_signature"; + @SerializedName(SERIALIZED_NAME_HAS_SIGNATURE) + @javax.annotation.Nonnull + private Boolean hasSignature; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters; + + public static final String SERIALIZED_NAME_RETURN_DATA_TYPE_ID = "return_data_type_id"; + @SerializedName(SERIALIZED_NAME_RETURN_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long returnDataTypeId; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this signature came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nullable + private SourceTypeEnum sourceType; + + public FunctionSignatureEntry() { + } + + public FunctionSignatureEntry callingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + return this; + } + + /** + * Calling convention, when the producer reported one. + * @return callingConvention + */ + @javax.annotation.Nullable + public String getCallingConvention() { + return callingConvention; + } + + public void setCallingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + } + + + public FunctionSignatureEntry createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this signature was extracted. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public FunctionSignatureEntry functionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + return this; + } + + /** + * Get functionId + * @return functionId + */ + @javax.annotation.Nonnull + public Long getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nonnull Long functionId) { + this.functionId = functionId; + } + + + public FunctionSignatureEntry functionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Current name of the function. + * @return functionName + */ + @javax.annotation.Nonnull + public String getFunctionName() { + return functionName; + } + + public void setFunctionName(@javax.annotation.Nonnull String functionName) { + this.functionName = functionName; + } + + + public FunctionSignatureEntry hasSignature(@javax.annotation.Nonnull Boolean hasSignature) { + this.hasSignature = hasSignature; + return this; + } + + /** + * Whether a signature was extracted for this function. False is a normal result: no signature is recorded unless data type extraction ran for the analysis, and thunks and external functions are skipped when it does. + * @return hasSignature + */ + @javax.annotation.Nonnull + public Boolean getHasSignature() { + return hasSignature; + } + + public void setHasSignature(@javax.annotation.Nonnull Boolean hasSignature) { + this.hasSignature = hasSignature; + } + + + public FunctionSignatureEntry parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public FunctionSignatureEntry addParametersItem(SignatureParameterEntry parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Parameters in argument order. Empty with has_signature true means the function is known to take no arguments. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public FunctionSignatureEntry returnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + return this; + } + + /** + * Return type, resolvable against the analysis data types list. Absent for an unresolved return type. + * @return returnDataTypeId + */ + @javax.annotation.Nullable + public Long getReturnDataTypeId() { + return returnDataTypeId; + } + + public void setReturnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + } + + + public FunctionSignatureEntry sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this signature was copied from, when it was transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public FunctionSignatureEntry sourceType(@javax.annotation.Nullable SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this signature came from. + * @return sourceType + */ + @javax.annotation.Nullable + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nullable SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FunctionSignatureEntry functionSignatureEntry = (FunctionSignatureEntry) o; + return Objects.equals(this.callingConvention, functionSignatureEntry.callingConvention) && + Objects.equals(this.createdAt, functionSignatureEntry.createdAt) && + Objects.equals(this.functionId, functionSignatureEntry.functionId) && + Objects.equals(this.functionName, functionSignatureEntry.functionName) && + Objects.equals(this.hasSignature, functionSignatureEntry.hasSignature) && + Objects.equals(this.parameters, functionSignatureEntry.parameters) && + Objects.equals(this.returnDataTypeId, functionSignatureEntry.returnDataTypeId) && + Objects.equals(this.sourceFunctionId, functionSignatureEntry.sourceFunctionId) && + Objects.equals(this.sourceType, functionSignatureEntry.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(callingConvention, createdAt, functionId, functionName, hasSignature, parameters, returnDataTypeId, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionSignatureEntry {\n"); + sb.append(" callingConvention: ").append(toIndentedString(callingConvention)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" functionName: ").append(toIndentedString(functionName)).append("\n"); + sb.append(" hasSignature: ").append(toIndentedString(hasSignature)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" returnDataTypeId: ").append(toIndentedString(returnDataTypeId)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).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("calling_convention", "created_at", "function_id", "function_name", "has_signature", "parameters", "return_data_type_id", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("function_id", "function_name", "has_signature", "parameters")); + } + + /** + * 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 FunctionSignatureEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionSignatureEntry.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 FunctionSignatureEntry is not found in the empty JSON string", FunctionSignatureEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FunctionSignatureEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionSignatureEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionSignatureEntry.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("calling_convention") != null && !jsonObj.get("calling_convention").isJsonNull()) && !jsonObj.get("calling_convention").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `calling_convention` to be a primitive type in the JSON string but got `%s`", jsonObj.get("calling_convention").toString())); + } + if (!jsonObj.get("function_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("function_name").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + SignatureParameterEntry.validateJsonElement(jsonArrayparameters.get(i)); + } + } + if ((jsonObj.get("source_type") != null && !jsonObj.get("source_type").isJsonNull()) && !jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the optional field `source_type` + if (jsonObj.get("source_type") != null && !jsonObj.get("source_type").isJsonNull()) { + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionSignatureEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionSignatureEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FunctionSignatureEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionSignatureEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FunctionSignatureEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FunctionSignatureEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionSignatureEntry + * @throws IOException if the JSON string is invalid with respect to FunctionSignatureEntry + */ + public static FunctionSignatureEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionSignatureEntry.class); + } + + /** + * Convert an instance of FunctionSignatureEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionSignatureVersion.java b/src/main/java/ai/reveng/model/FunctionSignatureVersion.java new file mode 100644 index 00000000..99dbaa7b --- /dev/null +++ b/src/main/java/ai/reveng/model/FunctionSignatureVersion.java @@ -0,0 +1,266 @@ +/* + * 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.FunctionSignatureEntry; +import ai.reveng.model.HistoryActor; +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; + +/** + * FunctionSignatureVersion + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FunctionSignatureVersion { + public static final String SERIALIZED_NAME_UPDATED_AT = "updated_at"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_UPDATED_BY = "updated_by"; + @SerializedName(SERIALIZED_NAME_UPDATED_BY) + @javax.annotation.Nullable + private HistoryActor updatedBy; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private FunctionSignatureEntry value; + + public FunctionSignatureVersion() { + } + + public FunctionSignatureVersion updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * When this version was written. Absent on a version that predates the recorded history. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public FunctionSignatureVersion updatedBy(@javax.annotation.Nullable HistoryActor updatedBy) { + this.updatedBy = updatedBy; + return this; + } + + /** + * Who wrote this version. Absent on a version that predates the recorded history. + * @return updatedBy + */ + @javax.annotation.Nullable + public HistoryActor getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedBy(@javax.annotation.Nullable HistoryActor updatedBy) { + this.updatedBy = updatedBy; + } + + + public FunctionSignatureVersion value(@javax.annotation.Nonnull FunctionSignatureEntry value) { + this.value = value; + return this; + } + + /** + * The signature as it stood in this version. + * @return value + */ + @javax.annotation.Nonnull + public FunctionSignatureEntry getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull FunctionSignatureEntry value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FunctionSignatureVersion functionSignatureVersion = (FunctionSignatureVersion) o; + return Objects.equals(this.updatedAt, functionSignatureVersion.updatedAt) && + Objects.equals(this.updatedBy, functionSignatureVersion.updatedBy) && + Objects.equals(this.value, functionSignatureVersion.value); + } + + @Override + public int hashCode() { + return Objects.hash(updatedAt, updatedBy, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FunctionSignatureVersion {\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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("updated_at", "updated_by", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("value")); + } + + /** + * 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 FunctionSignatureVersion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FunctionSignatureVersion.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 FunctionSignatureVersion is not found in the empty JSON string", FunctionSignatureVersion.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FunctionSignatureVersion.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionSignatureVersion` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FunctionSignatureVersion.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(); + // validate the optional field `updated_by` + if (jsonObj.get("updated_by") != null && !jsonObj.get("updated_by").isJsonNull()) { + HistoryActor.validateJsonElement(jsonObj.get("updated_by")); + } + // validate the required field `value` + FunctionSignatureEntry.validateJsonElement(jsonObj.get("value")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FunctionSignatureVersion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionSignatureVersion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FunctionSignatureVersion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FunctionSignatureVersion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FunctionSignatureVersion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FunctionSignatureVersion given an JSON string + * + * @param jsonString JSON string + * @return An instance of FunctionSignatureVersion + * @throws IOException if the JSON string is invalid with respect to FunctionSignatureVersion + */ + public static FunctionSignatureVersion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionSignatureVersion.class); + } + + /** + * Convert an instance of FunctionSignatureVersion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionType.java b/src/main/java/ai/reveng/model/FunctionType.java deleted file mode 100644 index 35f8eccc..00000000 --- a/src/main/java/ai/reveng/model/FunctionType.java +++ /dev/null @@ -1,442 +0,0 @@ -/* - * 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.FunctionHeader; -import ai.reveng.model.FunctionStackVariable; -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; - -/** - * FunctionType - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionType { - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nonnull - private Long addr; - - public static final String SERIALIZED_NAME_ARTIFACT_TYPE = "artifact_type"; - @SerializedName(SERIALIZED_NAME_ARTIFACT_TYPE) - @javax.annotation.Nullable - private String artifactType; - - public static final String SERIALIZED_NAME_HEADER = "header"; - @SerializedName(SERIALIZED_NAME_HEADER) - @javax.annotation.Nonnull - private FunctionHeader header; - - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_SCOPE = "scope"; - @SerializedName(SERIALIZED_NAME_SCOPE) - @javax.annotation.Nullable - private String scope; - - public static final String SERIALIZED_NAME_SIZE = "size"; - @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nonnull - private Long size; - - public static final String SERIALIZED_NAME_STACK_VARS = "stack_vars"; - @SerializedName(SERIALIZED_NAME_STACK_VARS) - @javax.annotation.Nullable - private Map stackVars = new HashMap<>(); - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public FunctionType() { - } - - public FunctionType addr(@javax.annotation.Nonnull Long addr) { - this.addr = addr; - return this; - } - - /** - * Get addr - * @return addr - */ - @javax.annotation.Nonnull - public Long getAddr() { - return addr; - } - - public void setAddr(@javax.annotation.Nonnull Long addr) { - this.addr = addr; - } - - - public FunctionType artifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - return this; - } - - /** - * Get artifactType - * @return artifactType - */ - @javax.annotation.Nullable - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - } - - - public FunctionType header(@javax.annotation.Nonnull FunctionHeader header) { - this.header = header; - return this; - } - - /** - * Get header - * @return header - */ - @javax.annotation.Nonnull - public FunctionHeader getHeader() { - return header; - } - - public void setHeader(@javax.annotation.Nonnull FunctionHeader header) { - this.header = header; - } - - - public FunctionType lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Get lastChange - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public FunctionType name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public FunctionType scope(@javax.annotation.Nullable String scope) { - this.scope = scope; - return this; - } - - /** - * Get scope - * @return scope - */ - @javax.annotation.Nullable - public String getScope() { - return scope; - } - - public void setScope(@javax.annotation.Nullable String scope) { - this.scope = scope; - } - - - public FunctionType size(@javax.annotation.Nonnull Long size) { - this.size = size; - return this; - } - - /** - * Get size - * @return size - */ - @javax.annotation.Nonnull - public Long getSize() { - return size; - } - - public void setSize(@javax.annotation.Nonnull Long size) { - this.size = size; - } - - - public FunctionType stackVars(@javax.annotation.Nullable Map stackVars) { - this.stackVars = stackVars; - return this; - } - - public FunctionType putStackVarsItem(String key, FunctionStackVariable stackVarsItem) { - if (this.stackVars == null) { - this.stackVars = new HashMap<>(); - } - this.stackVars.put(key, stackVarsItem); - return this; - } - - /** - * Stack variables keyed by offset hex. - * @return stackVars - */ - @javax.annotation.Nullable - public Map getStackVars() { - return stackVars; - } - - public void setStackVars(@javax.annotation.Nullable Map stackVars) { - this.stackVars = stackVars; - } - - - public FunctionType type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FunctionType functionType = (FunctionType) o; - return Objects.equals(this.addr, functionType.addr) && - Objects.equals(this.artifactType, functionType.artifactType) && - Objects.equals(this.header, functionType.header) && - Objects.equals(this.lastChange, functionType.lastChange) && - Objects.equals(this.name, functionType.name) && - Objects.equals(this.scope, functionType.scope) && - Objects.equals(this.size, functionType.size) && - Objects.equals(this.stackVars, functionType.stackVars) && - Objects.equals(this.type, functionType.type); - } - - @Override - public int hashCode() { - return Objects.hash(addr, artifactType, header, lastChange, name, scope, size, stackVars, type); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FunctionType {\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" artifactType: ").append(toIndentedString(artifactType)).append("\n"); - sb.append(" header: ").append(toIndentedString(header)).append("\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" stackVars: ").append(toIndentedString(stackVars)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).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("addr", "artifact_type", "header", "last_change", "name", "scope", "size", "stack_vars", "type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("addr", "header", "name", "size", "type")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to FunctionType - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FunctionType.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 FunctionType is not found in the empty JSON string", FunctionType.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FunctionType.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionType.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("artifact_type") != null && !jsonObj.get("artifact_type").isJsonNull()) && !jsonObj.get("artifact_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `artifact_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("artifact_type").toString())); - } - // validate the required field `header` - FunctionHeader.validateJsonElement(jsonObj.get("header")); - if ((jsonObj.get("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionType.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionType' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionType.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, FunctionType value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FunctionType read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - - }.nullSafe(); - } - } - - /** - * Create an instance of FunctionType given an JSON string - * - * @param jsonString JSON string - * @return An instance of FunctionType - * @throws IOException if the JSON string is invalid with respect to FunctionType - */ - public static FunctionType fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionType.class); - } - - /** - * Convert an instance of FunctionType to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/FunctionInfo.java b/src/main/java/ai/reveng/model/FunctionTypeDefinition.java similarity index 53% rename from src/main/java/ai/reveng/model/FunctionInfo.java rename to src/main/java/ai/reveng/model/FunctionTypeDefinition.java index 9ce34c0a..94454fbd 100644 --- a/src/main/java/ai/reveng/model/FunctionInfo.java +++ b/src/main/java/ai/reveng/model/FunctionTypeDefinition.java @@ -13,8 +13,7 @@ package ai.reveng.model; import java.util.Objects; -import ai.reveng.model.FunctionDependency; -import ai.reveng.model.FunctionType; +import ai.reveng.model.DataTypeFunctionParameterEntry; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -49,66 +48,66 @@ import ai.reveng.invoker.JSON; /** - * FunctionInfo + * FunctionTypeDefinition */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionInfo { - public static final String SERIALIZED_NAME_FUNC_DEPS = "func_deps"; - @SerializedName(SERIALIZED_NAME_FUNC_DEPS) +public class FunctionTypeDefinition { + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) @javax.annotation.Nullable - private List funcDeps; + private List parameters; - public static final String SERIALIZED_NAME_FUNC_TYPES = "func_types"; - @SerializedName(SERIALIZED_NAME_FUNC_TYPES) + public static final String SERIALIZED_NAME_RETURN_DATA_TYPE_ID = "return_data_type_id"; + @SerializedName(SERIALIZED_NAME_RETURN_DATA_TYPE_ID) @javax.annotation.Nullable - private FunctionType funcTypes; + private Long returnDataTypeId; - public FunctionInfo() { + public FunctionTypeDefinition() { } - public FunctionInfo funcDeps(@javax.annotation.Nullable List funcDeps) { - this.funcDeps = funcDeps; + public FunctionTypeDefinition parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; return this; } - public FunctionInfo addFuncDepsItem(FunctionDependency funcDepsItem) { - if (this.funcDeps == null) { - this.funcDeps = new ArrayList<>(); + public FunctionTypeDefinition addParametersItem(DataTypeFunctionParameterEntry parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); } - this.funcDeps.add(funcDepsItem); + this.parameters.add(parametersItem); return this; } /** - * Get funcDeps - * @return funcDeps + * The parameters, in argument order. + * @return parameters */ @javax.annotation.Nullable - public List getFuncDeps() { - return funcDeps; + public List getParameters() { + return parameters; } - public void setFuncDeps(@javax.annotation.Nullable List funcDeps) { - this.funcDeps = funcDeps; + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; } - public FunctionInfo funcTypes(@javax.annotation.Nullable FunctionType funcTypes) { - this.funcTypes = funcTypes; + public FunctionTypeDefinition returnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; return this; } /** - * Get funcTypes - * @return funcTypes + * The return type. + * @return returnDataTypeId */ @javax.annotation.Nullable - public FunctionType getFuncTypes() { - return funcTypes; + public Long getReturnDataTypeId() { + return returnDataTypeId; } - public void setFuncTypes(@javax.annotation.Nullable FunctionType funcTypes) { - this.funcTypes = funcTypes; + public void setReturnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; } @@ -121,22 +120,22 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FunctionInfo functionInfo = (FunctionInfo) o; - return Objects.equals(this.funcDeps, functionInfo.funcDeps) && - Objects.equals(this.funcTypes, functionInfo.funcTypes); + FunctionTypeDefinition functionTypeDefinition = (FunctionTypeDefinition) o; + return Objects.equals(this.parameters, functionTypeDefinition.parameters) && + Objects.equals(this.returnDataTypeId, functionTypeDefinition.returnDataTypeId); } @Override public int hashCode() { - return Objects.hash(funcDeps, funcTypes); + return Objects.hash(parameters, returnDataTypeId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class FunctionInfo {\n"); - sb.append(" funcDeps: ").append(toIndentedString(funcDeps)).append("\n"); - sb.append(" funcTypes: ").append(toIndentedString(funcTypes)).append("\n"); + sb.append("class FunctionTypeDefinition {\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" returnDataTypeId: ").append(toIndentedString(returnDataTypeId)).append("\n"); sb.append("}"); return sb.toString(); } @@ -155,76 +154,72 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("func_deps", "func_types")); + openapiFields = new HashSet(Arrays.asList("parameters", "return_data_type_id")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("func_deps")); + openapiRequiredFields = new HashSet(Arrays.asList("parameters")); } /** * 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 FunctionInfo + * @throws IOException if the JSON Element is invalid with respect to FunctionTypeDefinition */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!FunctionInfo.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 FunctionInfo is not found in the empty JSON string", FunctionInfo.openapiRequiredFields.toString())); + if (!FunctionTypeDefinition.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 FunctionTypeDefinition is not found in the empty JSON string", FunctionTypeDefinition.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!FunctionInfo.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!FunctionTypeDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionTypeDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionInfo.openapiRequiredFields) { + for (String requiredField : FunctionTypeDefinition.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("func_deps") != null && !jsonObj.get("func_deps").isJsonNull()) { - if (!jsonObj.get("func_deps").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `func_deps` to be an array in the JSON string but got `%s`", jsonObj.get("func_deps").toString())); + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); } - JsonArray jsonArrayfuncDeps = jsonObj.getAsJsonArray("func_deps"); - // validate the required field `func_deps` (array) - for (int i = 0; i < jsonArrayfuncDeps.size(); i++) { - FunctionDependency.validateJsonElement(jsonArrayfuncDeps.get(i)); + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + DataTypeFunctionParameterEntry.validateJsonElement(jsonArrayparameters.get(i)); } } - // validate the optional field `func_types` - if (jsonObj.get("func_types") != null && !jsonObj.get("func_types").isJsonNull()) { - FunctionType.validateJsonElement(jsonObj.get("func_types")); - } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionInfo.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionInfo' and its subtypes + if (!FunctionTypeDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FunctionTypeDefinition' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionInfo.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FunctionTypeDefinition.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, FunctionInfo value) throws IOException { + public void write(JsonWriter out, FunctionTypeDefinition value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public FunctionInfo read(JsonReader in) throws IOException { + public FunctionTypeDefinition read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -235,18 +230,18 @@ public FunctionInfo read(JsonReader in) throws IOException { } /** - * Create an instance of FunctionInfo given an JSON string + * Create an instance of FunctionTypeDefinition given an JSON string * * @param jsonString JSON string - * @return An instance of FunctionInfo - * @throws IOException if the JSON string is invalid with respect to FunctionInfo + * @return An instance of FunctionTypeDefinition + * @throws IOException if the JSON string is invalid with respect to FunctionTypeDefinition */ - public static FunctionInfo fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionInfo.class); + public static FunctionTypeDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FunctionTypeDefinition.class); } /** - * Convert an instance of FunctionInfo to an JSON string + * Convert an instance of FunctionTypeDefinition to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/GenerateFunctionDataTypes.java b/src/main/java/ai/reveng/model/GenerateFunctionDataTypes.java deleted file mode 100644 index 6958b7c6..00000000 --- a/src/main/java/ai/reveng/model/GenerateFunctionDataTypes.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * 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.GenerationStatusList; -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; - -/** - * GenerateFunctionDataTypes - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class GenerateFunctionDataTypes { - public static final String SERIALIZED_NAME_QUEUED = "queued"; - @Deprecated - @SerializedName(SERIALIZED_NAME_QUEUED) - @javax.annotation.Nonnull - private Boolean queued; - - public static final String SERIALIZED_NAME_REFERENCE = "reference"; - @Deprecated - @SerializedName(SERIALIZED_NAME_REFERENCE) - @javax.annotation.Nonnull - private String reference; - - public static final String SERIALIZED_NAME_DATA_TYPES_LIST = "data_types_list"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_LIST) - @javax.annotation.Nonnull - private GenerationStatusList dataTypesList; - - public GenerateFunctionDataTypes() { - } - - @Deprecated - public GenerateFunctionDataTypes queued(@javax.annotation.Nonnull Boolean queued) { - this.queued = queued; - return this; - } - - /** - * [DEPRECATED] This value has been replaced with the `data_types_list` field - * @return queued - * @deprecated - */ - @Deprecated - @javax.annotation.Nonnull - public Boolean getQueued() { - return queued; - } - - @Deprecated - public void setQueued(@javax.annotation.Nonnull Boolean queued) { - this.queued = queued; - } - - - @Deprecated - public GenerateFunctionDataTypes reference(@javax.annotation.Nonnull String reference) { - this.reference = reference; - return this; - } - - /** - * [DEPRECATED] This value has been replaced with the `data_types_list` field - * @return reference - * @deprecated - */ - @Deprecated - @javax.annotation.Nonnull - public String getReference() { - return reference; - } - - @Deprecated - public void setReference(@javax.annotation.Nonnull String reference) { - this.reference = reference; - } - - - public GenerateFunctionDataTypes dataTypesList(@javax.annotation.Nonnull GenerationStatusList dataTypesList) { - this.dataTypesList = dataTypesList; - return this; - } - - /** - * List of function data types information that are either already generated, or now queued for generation - * @return dataTypesList - */ - @javax.annotation.Nonnull - public GenerationStatusList getDataTypesList() { - return dataTypesList; - } - - public void setDataTypesList(@javax.annotation.Nonnull GenerationStatusList dataTypesList) { - this.dataTypesList = dataTypesList; - } - - /** - * 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 GenerateFunctionDataTypes instance itself - */ - public GenerateFunctionDataTypes 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; - } - GenerateFunctionDataTypes generateFunctionDataTypes = (GenerateFunctionDataTypes) o; - return Objects.equals(this.queued, generateFunctionDataTypes.queued) && - Objects.equals(this.reference, generateFunctionDataTypes.reference) && - Objects.equals(this.dataTypesList, generateFunctionDataTypes.dataTypesList)&& - Objects.equals(this.additionalProperties, generateFunctionDataTypes.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(queued, reference, dataTypesList, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GenerateFunctionDataTypes {\n"); - sb.append(" queued: ").append(toIndentedString(queued)).append("\n"); - sb.append(" reference: ").append(toIndentedString(reference)).append("\n"); - sb.append(" dataTypesList: ").append(toIndentedString(dataTypesList)).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("queued", "reference", "data_types_list")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("queued", "reference", "data_types_list")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to GenerateFunctionDataTypes - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GenerateFunctionDataTypes.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 GenerateFunctionDataTypes is not found in the empty JSON string", GenerateFunctionDataTypes.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GenerateFunctionDataTypes.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("reference").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reference").toString())); - } - // validate the required field `data_types_list` - GenerationStatusList.validateJsonElement(jsonObj.get("data_types_list")); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GenerateFunctionDataTypes.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GenerateFunctionDataTypes' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GenerateFunctionDataTypes.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GenerateFunctionDataTypes 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 GenerateFunctionDataTypes read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - GenerateFunctionDataTypes 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 GenerateFunctionDataTypes given an JSON string - * - * @param jsonString JSON string - * @return An instance of GenerateFunctionDataTypes - * @throws IOException if the JSON string is invalid with respect to GenerateFunctionDataTypes - */ - public static GenerateFunctionDataTypes fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GenerateFunctionDataTypes.class); - } - - /** - * Convert an instance of GenerateFunctionDataTypes to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/GenerationStatusList.java b/src/main/java/ai/reveng/model/GenerationStatusList.java deleted file mode 100644 index ced7c044..00000000 --- a/src/main/java/ai/reveng/model/GenerationStatusList.java +++ /dev/null @@ -1,359 +0,0 @@ -/* - * 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.FunctionDataTypesStatus; -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; - -/** - * GenerationStatusList - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class GenerationStatusList { - public static final String SERIALIZED_NAME_TOTAL_COUNT = "total_count"; - @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) - @javax.annotation.Nullable - private Integer totalCount = 0; - - public static final String SERIALIZED_NAME_TOTAL_DATA_TYPES_COUNT = "total_data_types_count"; - @SerializedName(SERIALIZED_NAME_TOTAL_DATA_TYPES_COUNT) - @javax.annotation.Nullable - private Integer totalDataTypesCount = 0; - - public static final String SERIALIZED_NAME_ITEMS = "items"; - @SerializedName(SERIALIZED_NAME_ITEMS) - @javax.annotation.Nonnull - private List items = new ArrayList<>(); - - public GenerationStatusList() { - } - - public GenerationStatusList totalCount(@javax.annotation.Nullable Integer totalCount) { - this.totalCount = totalCount; - return this; - } - - /** - * Total number of functions in analysis - * @return totalCount - */ - @javax.annotation.Nullable - public Integer getTotalCount() { - return totalCount; - } - - public void setTotalCount(@javax.annotation.Nullable Integer totalCount) { - this.totalCount = totalCount; - } - - - public GenerationStatusList totalDataTypesCount(@javax.annotation.Nullable Integer totalDataTypesCount) { - this.totalDataTypesCount = totalDataTypesCount; - return this; - } - - /** - * Total number of functions with data types - * @return totalDataTypesCount - */ - @javax.annotation.Nullable - public Integer getTotalDataTypesCount() { - return totalDataTypesCount; - } - - public void setTotalDataTypesCount(@javax.annotation.Nullable Integer totalDataTypesCount) { - this.totalDataTypesCount = totalDataTypesCount; - } - - - public GenerationStatusList items(@javax.annotation.Nonnull List items) { - this.items = items; - return this; - } - - public GenerationStatusList addItemsItem(FunctionDataTypesStatus itemsItem) { - if (this.items == null) { - this.items = new ArrayList<>(); - } - this.items.add(itemsItem); - return this; - } - - /** - * List of function data types information - * @return items - */ - @javax.annotation.Nonnull - public List getItems() { - return items; - } - - public void setItems(@javax.annotation.Nonnull List items) { - this.items = items; - } - - /** - * 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 GenerationStatusList instance itself - */ - public GenerationStatusList 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; - } - GenerationStatusList generationStatusList = (GenerationStatusList) o; - return Objects.equals(this.totalCount, generationStatusList.totalCount) && - Objects.equals(this.totalDataTypesCount, generationStatusList.totalDataTypesCount) && - Objects.equals(this.items, generationStatusList.items)&& - Objects.equals(this.additionalProperties, generationStatusList.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(totalCount, totalDataTypesCount, items, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GenerationStatusList {\n"); - sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); - sb.append(" totalDataTypesCount: ").append(toIndentedString(totalDataTypesCount)).append("\n"); - sb.append(" items: ").append(toIndentedString(items)).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("total_count", "total_data_types_count", "items")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("items")); - } - - /** - * 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 GenerationStatusList - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GenerationStatusList.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 GenerationStatusList is not found in the empty JSON string", GenerationStatusList.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GenerationStatusList.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("items") != null) { - if (!jsonObj.get("items").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); - } - JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); - // validate the required field `items` (array) - for (int i = 0; i < jsonArrayitems.size(); i++) { - FunctionDataTypesStatus.validateJsonElement(jsonArrayitems.get(i)); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GenerationStatusList.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GenerationStatusList' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GenerationStatusList.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GenerationStatusList 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 GenerationStatusList read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - GenerationStatusList 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 GenerationStatusList given an JSON string - * - * @param jsonString JSON string - * @return An instance of GenerationStatusList - * @throws IOException if the JSON string is invalid with respect to GenerationStatusList - */ - public static GenerationStatusList fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GenerationStatusList.class); - } - - /** - * Convert an instance of GenerationStatusList to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/BatchUpdateDataTypesOutputBody.java b/src/main/java/ai/reveng/model/GetAnalysisLogsOutputBody.java similarity index 57% rename from src/main/java/ai/reveng/model/BatchUpdateDataTypesOutputBody.java rename to src/main/java/ai/reveng/model/GetAnalysisLogsOutputBody.java index 45db416b..6d0b0314 100644 --- a/src/main/java/ai/reveng/model/BatchUpdateDataTypesOutputBody.java +++ b/src/main/java/ai/reveng/model/GetAnalysisLogsOutputBody.java @@ -13,7 +13,7 @@ package ai.reveng.model; import java.util.Objects; -import ai.reveng.model.BatchUpdateDataTypesResult; +import ai.reveng.model.AnalysisLogEntry; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -48,42 +48,42 @@ import ai.reveng.invoker.JSON; /** - * BatchUpdateDataTypesOutputBody + * GetAnalysisLogsOutputBody */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BatchUpdateDataTypesOutputBody { - public static final String SERIALIZED_NAME_RESULTS = "results"; - @SerializedName(SERIALIZED_NAME_RESULTS) +public class GetAnalysisLogsOutputBody { + public static final String SERIALIZED_NAME_ENTRIES = "entries"; + @SerializedName(SERIALIZED_NAME_ENTRIES) @javax.annotation.Nullable - private List results; + private List entries; - public BatchUpdateDataTypesOutputBody() { + public GetAnalysisLogsOutputBody() { } - public BatchUpdateDataTypesOutputBody results(@javax.annotation.Nullable List results) { - this.results = results; + public GetAnalysisLogsOutputBody entries(@javax.annotation.Nullable List entries) { + this.entries = entries; return this; } - public BatchUpdateDataTypesOutputBody addResultsItem(BatchUpdateDataTypesResult resultsItem) { - if (this.results == null) { - this.results = new ArrayList<>(); + public GetAnalysisLogsOutputBody addEntriesItem(AnalysisLogEntry entriesItem) { + if (this.entries == null) { + this.entries = new ArrayList<>(); } - this.results.add(resultsItem); + this.entries.add(entriesItem); return this; } /** - * Per-function outcomes in the same order as the input - * @return results + * Analysis log lines, oldest first + * @return entries */ @javax.annotation.Nullable - public List getResults() { - return results; + public List getEntries() { + return entries; } - public void setResults(@javax.annotation.Nullable List results) { - this.results = results; + public void setEntries(@javax.annotation.Nullable List entries) { + this.entries = entries; } @@ -96,20 +96,20 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BatchUpdateDataTypesOutputBody batchUpdateDataTypesOutputBody = (BatchUpdateDataTypesOutputBody) o; - return Objects.equals(this.results, batchUpdateDataTypesOutputBody.results); + GetAnalysisLogsOutputBody getAnalysisLogsOutputBody = (GetAnalysisLogsOutputBody) o; + return Objects.equals(this.entries, getAnalysisLogsOutputBody.entries); } @Override public int hashCode() { - return Objects.hash(results); + return Objects.hash(entries); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BatchUpdateDataTypesOutputBody {\n"); - sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append("class GetAnalysisLogsOutputBody {\n"); + sb.append(" entries: ").append(toIndentedString(entries)).append("\n"); sb.append("}"); return sb.toString(); } @@ -128,48 +128,48 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("results")); + openapiFields = new HashSet(Arrays.asList("entries")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("results")); + openapiRequiredFields = new HashSet(Arrays.asList("entries")); } /** * 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 BatchUpdateDataTypesOutputBody + * @throws IOException if the JSON Element is invalid with respect to GetAnalysisLogsOutputBody */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!BatchUpdateDataTypesOutputBody.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 BatchUpdateDataTypesOutputBody is not found in the empty JSON string", BatchUpdateDataTypesOutputBody.openapiRequiredFields.toString())); + if (!GetAnalysisLogsOutputBody.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 GetAnalysisLogsOutputBody is not found in the empty JSON string", GetAnalysisLogsOutputBody.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!BatchUpdateDataTypesOutputBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BatchUpdateDataTypesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!GetAnalysisLogsOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `GetAnalysisLogsOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BatchUpdateDataTypesOutputBody.openapiRequiredFields) { + for (String requiredField : GetAnalysisLogsOutputBody.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("results") != null && !jsonObj.get("results").isJsonNull()) { - if (!jsonObj.get("results").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); + if (jsonObj.get("entries") != null && !jsonObj.get("entries").isJsonNull()) { + if (!jsonObj.get("entries").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `entries` to be an array in the JSON string but got `%s`", jsonObj.get("entries").toString())); } - JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); - // validate the required field `results` (array) - for (int i = 0; i < jsonArrayresults.size(); i++) { - BatchUpdateDataTypesResult.validateJsonElement(jsonArrayresults.get(i)); + JsonArray jsonArrayentries = jsonObj.getAsJsonArray("entries"); + // validate the required field `entries` (array) + for (int i = 0; i < jsonArrayentries.size(); i++) { + AnalysisLogEntry.validateJsonElement(jsonArrayentries.get(i)); } } } @@ -178,22 +178,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchUpdateDataTypesOutputBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchUpdateDataTypesOutputBody' and its subtypes + if (!GetAnalysisLogsOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetAnalysisLogsOutputBody' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchUpdateDataTypesOutputBody.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetAnalysisLogsOutputBody.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, BatchUpdateDataTypesOutputBody value) throws IOException { + public void write(JsonWriter out, GetAnalysisLogsOutputBody value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public BatchUpdateDataTypesOutputBody read(JsonReader in) throws IOException { + public GetAnalysisLogsOutputBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -204,18 +204,18 @@ public BatchUpdateDataTypesOutputBody read(JsonReader in) throws IOException { } /** - * Create an instance of BatchUpdateDataTypesOutputBody given an JSON string + * Create an instance of GetAnalysisLogsOutputBody given an JSON string * * @param jsonString JSON string - * @return An instance of BatchUpdateDataTypesOutputBody - * @throws IOException if the JSON string is invalid with respect to BatchUpdateDataTypesOutputBody + * @return An instance of GetAnalysisLogsOutputBody + * @throws IOException if the JSON string is invalid with respect to GetAnalysisLogsOutputBody */ - public static BatchUpdateDataTypesOutputBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BatchUpdateDataTypesOutputBody.class); + public static GetAnalysisLogsOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetAnalysisLogsOutputBody.class); } /** - * Convert an instance of BatchUpdateDataTypesOutputBody to an JSON string + * Convert an instance of GetAnalysisLogsOutputBody to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/GetDataTypeHistoryBody.java b/src/main/java/ai/reveng/model/GetDataTypeHistoryBody.java new file mode 100644 index 00000000..4e27ee2d --- /dev/null +++ b/src/main/java/ai/reveng/model/GetDataTypeHistoryBody.java @@ -0,0 +1,226 @@ +/* + * 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.DataTypeVersion; +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; + +/** + * GetDataTypeHistoryBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetDataTypeHistoryBody { + public static final String SERIALIZED_NAME_VERSIONS = "versions"; + @SerializedName(SERIALIZED_NAME_VERSIONS) + @javax.annotation.Nonnull + private List versions = new ArrayList<>(); + + public GetDataTypeHistoryBody() { + } + + public GetDataTypeHistoryBody versions(@javax.annotation.Nonnull List versions) { + this.versions = versions; + return this; + } + + public GetDataTypeHistoryBody addVersionsItem(DataTypeVersion versionsItem) { + if (this.versions == null) { + this.versions = new ArrayList<>(); + } + this.versions.add(versionsItem); + return this; + } + + /** + * Every version of the type, newest first. The first element is the current value, so the list is never empty; a type that has never been edited has that one element only. + * @return versions + */ + @javax.annotation.Nonnull + public List getVersions() { + return versions; + } + + public void setVersions(@javax.annotation.Nonnull List versions) { + this.versions = versions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDataTypeHistoryBody getDataTypeHistoryBody = (GetDataTypeHistoryBody) o; + return Objects.equals(this.versions, getDataTypeHistoryBody.versions); + } + + @Override + public int hashCode() { + return Objects.hash(versions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDataTypeHistoryBody {\n"); + sb.append(" versions: ").append(toIndentedString(versions)).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("versions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("versions")); + } + + /** + * 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 GetDataTypeHistoryBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetDataTypeHistoryBody.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 GetDataTypeHistoryBody is not found in the empty JSON string", GetDataTypeHistoryBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetDataTypeHistoryBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `GetDataTypeHistoryBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetDataTypeHistoryBody.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("versions") != null) { + if (!jsonObj.get("versions").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `versions` to be an array in the JSON string but got `%s`", jsonObj.get("versions").toString())); + } + JsonArray jsonArrayversions = jsonObj.getAsJsonArray("versions"); + // validate the required field `versions` (array) + for (int i = 0; i < jsonArrayversions.size(); i++) { + DataTypeVersion.validateJsonElement(jsonArrayversions.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetDataTypeHistoryBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetDataTypeHistoryBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetDataTypeHistoryBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetDataTypeHistoryBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetDataTypeHistoryBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetDataTypeHistoryBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetDataTypeHistoryBody + * @throws IOException if the JSON string is invalid with respect to GetDataTypeHistoryBody + */ + public static GetDataTypeHistoryBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetDataTypeHistoryBody.class); + } + + /** + * Convert an instance of GetDataTypeHistoryBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GetFunctionSignatureHistoryBody.java b/src/main/java/ai/reveng/model/GetFunctionSignatureHistoryBody.java new file mode 100644 index 00000000..6411076b --- /dev/null +++ b/src/main/java/ai/reveng/model/GetFunctionSignatureHistoryBody.java @@ -0,0 +1,226 @@ +/* + * 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.FunctionSignatureVersion; +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; + +/** + * GetFunctionSignatureHistoryBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetFunctionSignatureHistoryBody { + public static final String SERIALIZED_NAME_VERSIONS = "versions"; + @SerializedName(SERIALIZED_NAME_VERSIONS) + @javax.annotation.Nonnull + private List versions = new ArrayList<>(); + + public GetFunctionSignatureHistoryBody() { + } + + public GetFunctionSignatureHistoryBody versions(@javax.annotation.Nonnull List versions) { + this.versions = versions; + return this; + } + + public GetFunctionSignatureHistoryBody addVersionsItem(FunctionSignatureVersion versionsItem) { + if (this.versions == null) { + this.versions = new ArrayList<>(); + } + this.versions.add(versionsItem); + return this; + } + + /** + * Every version of the signature, newest first. The first element is the current value, so the list is never empty; a signature that has never been edited has that one element only. + * @return versions + */ + @javax.annotation.Nonnull + public List getVersions() { + return versions; + } + + public void setVersions(@javax.annotation.Nonnull List versions) { + this.versions = versions; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetFunctionSignatureHistoryBody getFunctionSignatureHistoryBody = (GetFunctionSignatureHistoryBody) o; + return Objects.equals(this.versions, getFunctionSignatureHistoryBody.versions); + } + + @Override + public int hashCode() { + return Objects.hash(versions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetFunctionSignatureHistoryBody {\n"); + sb.append(" versions: ").append(toIndentedString(versions)).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("versions")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("versions")); + } + + /** + * 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 GetFunctionSignatureHistoryBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetFunctionSignatureHistoryBody.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 GetFunctionSignatureHistoryBody is not found in the empty JSON string", GetFunctionSignatureHistoryBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetFunctionSignatureHistoryBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `GetFunctionSignatureHistoryBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetFunctionSignatureHistoryBody.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("versions") != null) { + if (!jsonObj.get("versions").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `versions` to be an array in the JSON string but got `%s`", jsonObj.get("versions").toString())); + } + JsonArray jsonArrayversions = jsonObj.getAsJsonArray("versions"); + // validate the required field `versions` (array) + for (int i = 0; i < jsonArrayversions.size(); i++) { + FunctionSignatureVersion.validateJsonElement(jsonArrayversions.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetFunctionSignatureHistoryBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetFunctionSignatureHistoryBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetFunctionSignatureHistoryBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetFunctionSignatureHistoryBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetFunctionSignatureHistoryBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetFunctionSignatureHistoryBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetFunctionSignatureHistoryBody + * @throws IOException if the JSON string is invalid with respect to GetFunctionSignatureHistoryBody + */ + public static GetFunctionSignatureHistoryBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetFunctionSignatureHistoryBody.class); + } + + /** + * Convert an instance of GetFunctionSignatureHistoryBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GetTokensResponse.java b/src/main/java/ai/reveng/model/GetTokensResponse.java new file mode 100644 index 00000000..9ef672a9 --- /dev/null +++ b/src/main/java/ai/reveng/model/GetTokensResponse.java @@ -0,0 +1,306 @@ +/* + * 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.RenderedToken; +import ai.reveng.model.Token; +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; + +/** + * GetTokensResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class GetTokensResponse { + public static final String SERIALIZED_NAME_AI_DECOMP = "ai_decomp"; + @SerializedName(SERIALIZED_NAME_AI_DECOMP) + @javax.annotation.Nonnull + private String aiDecomp; + + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + public static final String SERIALIZED_NAME_PLACEHOLDER_TO_RENDERED_TOKEN = "placeholder_to_rendered_token"; + @SerializedName(SERIALIZED_NAME_PLACEHOLDER_TO_RENDERED_TOKEN) + @javax.annotation.Nonnull + private Map placeholderToRenderedToken = new HashMap<>(); + + public static final String SERIALIZED_NAME_PLACEHOLDER_TO_USER_OVERRIDE = "placeholder_to_user_override"; + @SerializedName(SERIALIZED_NAME_PLACEHOLDER_TO_USER_OVERRIDE) + @javax.annotation.Nonnull + private Map placeholderToUserOverride = new HashMap<>(); + + public GetTokensResponse() { + } + + public GetTokensResponse aiDecomp(@javax.annotation.Nonnull String aiDecomp) { + this.aiDecomp = aiDecomp; + return this; + } + + /** + * Tokenised AI-decompilation. Includes generated comments. Empty until a run has succeeded. + * @return aiDecomp + */ + @javax.annotation.Nonnull + public String getAiDecomp() { + return aiDecomp; + } + + public void setAiDecomp(@javax.annotation.Nonnull String aiDecomp) { + this.aiDecomp = aiDecomp; + } + + + public GetTokensResponse analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * Analysis the function belongs to. Scopes every data_type_id below. + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public GetTokensResponse placeholderToRenderedToken(@javax.annotation.Nonnull Map placeholderToRenderedToken) { + this.placeholderToRenderedToken = placeholderToRenderedToken; + return this; + } + + public GetTokensResponse putPlaceholderToRenderedTokenItem(String key, RenderedToken placeholderToRenderedTokenItem) { + if (this.placeholderToRenderedToken == null) { + this.placeholderToRenderedToken = new HashMap<>(); + } + this.placeholderToRenderedToken.put(key, placeholderToRenderedTokenItem); + return this; + } + + /** + * Each placeholder token mapped to the value the server would render in its place, and the record it refers to. Null until a run has succeeded. + * @return placeholderToRenderedToken + */ + @javax.annotation.Nonnull + public Map getPlaceholderToRenderedToken() { + return placeholderToRenderedToken; + } + + public void setPlaceholderToRenderedToken(@javax.annotation.Nonnull Map placeholderToRenderedToken) { + this.placeholderToRenderedToken = placeholderToRenderedToken; + } + + + public GetTokensResponse placeholderToUserOverride(@javax.annotation.Nonnull Map placeholderToUserOverride) { + this.placeholderToUserOverride = placeholderToUserOverride; + return this; + } + + public GetTokensResponse putPlaceholderToUserOverrideItem(String key, Token placeholderToUserOverrideItem) { + if (this.placeholderToUserOverride == null) { + this.placeholderToUserOverride = new HashMap<>(); + } + this.placeholderToUserOverride.put(key, placeholderToUserOverrideItem); + return this; + } + + /** + * The caller's own overrides, keyed by token. Null until a run has succeeded. + * @return placeholderToUserOverride + */ + @javax.annotation.Nonnull + public Map getPlaceholderToUserOverride() { + return placeholderToUserOverride; + } + + public void setPlaceholderToUserOverride(@javax.annotation.Nonnull Map placeholderToUserOverride) { + this.placeholderToUserOverride = placeholderToUserOverride; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTokensResponse getTokensResponse = (GetTokensResponse) o; + return Objects.equals(this.aiDecomp, getTokensResponse.aiDecomp) && + Objects.equals(this.analysisId, getTokensResponse.analysisId) && + Objects.equals(this.placeholderToRenderedToken, getTokensResponse.placeholderToRenderedToken) && + Objects.equals(this.placeholderToUserOverride, getTokensResponse.placeholderToUserOverride); + } + + @Override + public int hashCode() { + return Objects.hash(aiDecomp, analysisId, placeholderToRenderedToken, placeholderToUserOverride); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetTokensResponse {\n"); + sb.append(" aiDecomp: ").append(toIndentedString(aiDecomp)).append("\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" placeholderToRenderedToken: ").append(toIndentedString(placeholderToRenderedToken)).append("\n"); + sb.append(" placeholderToUserOverride: ").append(toIndentedString(placeholderToUserOverride)).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("ai_decomp", "analysis_id", "placeholder_to_rendered_token", "placeholder_to_user_override")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("ai_decomp", "analysis_id", "placeholder_to_rendered_token", "placeholder_to_user_override")); + } + + /** + * 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 GetTokensResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GetTokensResponse.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 GetTokensResponse is not found in the empty JSON string", GetTokensResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GetTokensResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `GetTokensResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GetTokensResponse.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("ai_decomp").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `ai_decomp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ai_decomp").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GetTokensResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GetTokensResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GetTokensResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GetTokensResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GetTokensResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GetTokensResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of GetTokensResponse + * @throws IOException if the JSON string is invalid with respect to GetTokensResponse + */ + public static GetTokensResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GetTokensResponse.class); + } + + /** + * Convert an instance of GetTokensResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/GlobalVariable.java b/src/main/java/ai/reveng/model/GlobalVariable.java deleted file mode 100644 index 6b4624c3..00000000 --- a/src/main/java/ai/reveng/model/GlobalVariable.java +++ /dev/null @@ -1,440 +0,0 @@ -/* - * 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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * GlobalVariable - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class GlobalVariable { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nonnull - private Integer addr; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_SIZE = "size"; - @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nonnull - private Integer size; - - public static final String SERIALIZED_NAME_ARTIFACT_TYPE = "artifact_type"; - @SerializedName(SERIALIZED_NAME_ARTIFACT_TYPE) - @javax.annotation.Nullable - private String artifactType; - - public GlobalVariable() { - } - - public GlobalVariable lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this global variable - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public GlobalVariable addr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; - return this; - } - - /** - * Memory address of the global variable - * @return addr - */ - @javax.annotation.Nonnull - public Integer getAddr() { - return addr; - } - - public void setAddr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; - } - - - public GlobalVariable name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the global variable - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public GlobalVariable type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Data type of the global variable - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public GlobalVariable size(@javax.annotation.Nonnull Integer size) { - this.size = size; - return this; - } - - /** - * Size of the global variable in bytes - * @return size - */ - @javax.annotation.Nonnull - public Integer getSize() { - return size; - } - - public void setSize(@javax.annotation.Nonnull Integer size) { - this.size = size; - } - - - public GlobalVariable artifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - return this; - } - - /** - * Type of artifact that the global variable is associated with - * @return artifactType - */ - @javax.annotation.Nullable - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - } - - /** - * 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 GlobalVariable instance itself - */ - public GlobalVariable 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; - } - GlobalVariable globalVariable = (GlobalVariable) o; - return Objects.equals(this.lastChange, globalVariable.lastChange) && - Objects.equals(this.addr, globalVariable.addr) && - Objects.equals(this.name, globalVariable.name) && - Objects.equals(this.type, globalVariable.type) && - Objects.equals(this.size, globalVariable.size) && - Objects.equals(this.artifactType, globalVariable.artifactType)&& - Objects.equals(this.additionalProperties, globalVariable.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, addr, name, type, size, artifactType, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class GlobalVariable {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" artifactType: ").append(toIndentedString(artifactType)).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("last_change", "addr", "name", "type", "size", "artifact_type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("addr", "name", "type", "size")); - } - - /** - * 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 GlobalVariable - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!GlobalVariable.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 GlobalVariable is not found in the empty JSON string", GlobalVariable.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : GlobalVariable.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if ((jsonObj.get("artifact_type") != null && !jsonObj.get("artifact_type").isJsonNull()) && !jsonObj.get("artifact_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `artifact_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("artifact_type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!GlobalVariable.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'GlobalVariable' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(GlobalVariable.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, GlobalVariable 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 GlobalVariable read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - GlobalVariable 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 GlobalVariable given an JSON string - * - * @param jsonString JSON string - * @return An instance of GlobalVariable - * @throws IOException if the JSON string is invalid with respect to GlobalVariable - */ - public static GlobalVariable fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, GlobalVariable.class); - } - - /** - * Convert an instance of GlobalVariable to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/AIDecompInverseStringMapItem.java b/src/main/java/ai/reveng/model/HistoryActor.java similarity index 59% rename from src/main/java/ai/reveng/model/AIDecompInverseStringMapItem.java rename to src/main/java/ai/reveng/model/HistoryActor.java index aeae72d0..03819af9 100644 --- a/src/main/java/ai/reveng/model/AIDecompInverseStringMapItem.java +++ b/src/main/java/ai/reveng/model/HistoryActor.java @@ -45,58 +45,58 @@ import ai.reveng.invoker.JSON; /** - * AIDecompInverseStringMapItem + * HistoryActor */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class AIDecompInverseStringMapItem { - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nullable - private Long addr; - - public static final String SERIALIZED_NAME_STRING = "string"; - @SerializedName(SERIALIZED_NAME_STRING) +public class HistoryActor { + public static final String SERIALIZED_NAME_USER_ID = "user_id"; + @SerializedName(SERIALIZED_NAME_USER_ID) @javax.annotation.Nonnull - private String string; + private Long userId; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + @javax.annotation.Nullable + private String username; - public AIDecompInverseStringMapItem() { + public HistoryActor() { } - public AIDecompInverseStringMapItem addr(@javax.annotation.Nullable Long addr) { - this.addr = addr; + public HistoryActor userId(@javax.annotation.Nonnull Long userId) { + this.userId = userId; return this; } /** - * Get addr - * @return addr + * The user who made the change. + * @return userId */ - @javax.annotation.Nullable - public Long getAddr() { - return addr; + @javax.annotation.Nonnull + public Long getUserId() { + return userId; } - public void setAddr(@javax.annotation.Nullable Long addr) { - this.addr = addr; + public void setUserId(@javax.annotation.Nonnull Long userId) { + this.userId = userId; } - public AIDecompInverseStringMapItem string(@javax.annotation.Nonnull String string) { - this.string = string; + public HistoryActor username(@javax.annotation.Nullable String username) { + this.username = username; return this; } /** - * Get string - * @return string + * Absent when the user no longer exists. + * @return username */ - @javax.annotation.Nonnull - public String getString() { - return string; + @javax.annotation.Nullable + public String getUsername() { + return username; } - public void setString(@javax.annotation.Nonnull String string) { - this.string = string; + public void setUsername(@javax.annotation.Nullable String username) { + this.username = username; } @@ -109,22 +109,22 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AIDecompInverseStringMapItem aiDecompInverseStringMapItem = (AIDecompInverseStringMapItem) o; - return Objects.equals(this.addr, aiDecompInverseStringMapItem.addr) && - Objects.equals(this.string, aiDecompInverseStringMapItem.string); + HistoryActor historyActor = (HistoryActor) o; + return Objects.equals(this.userId, historyActor.userId) && + Objects.equals(this.username, historyActor.username); } @Override public int hashCode() { - return Objects.hash(addr, string); + return Objects.hash(userId, username); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AIDecompInverseStringMapItem {\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append("class HistoryActor {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); sb.append("}"); return sb.toString(); } @@ -143,42 +143,42 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("addr", "string")); + openapiFields = new HashSet(Arrays.asList("user_id", "username")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("addr", "string")); + openapiRequiredFields = new HashSet(Arrays.asList("user_id")); } /** * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to AIDecompInverseStringMapItem + * @throws IOException if the JSON Element is invalid with respect to HistoryActor */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!AIDecompInverseStringMapItem.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 AIDecompInverseStringMapItem is not found in the empty JSON string", AIDecompInverseStringMapItem.openapiRequiredFields.toString())); + if (!HistoryActor.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 HistoryActor is not found in the empty JSON string", HistoryActor.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!AIDecompInverseStringMapItem.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `AIDecompInverseStringMapItem` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!HistoryActor.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `HistoryActor` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AIDecompInverseStringMapItem.openapiRequiredFields) { + for (String requiredField : HistoryActor.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("string").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `string` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string").toString())); + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !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())); } } @@ -186,22 +186,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!AIDecompInverseStringMapItem.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AIDecompInverseStringMapItem' and its subtypes + if (!HistoryActor.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HistoryActor' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(AIDecompInverseStringMapItem.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HistoryActor.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, AIDecompInverseStringMapItem value) throws IOException { + public void write(JsonWriter out, HistoryActor value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public AIDecompInverseStringMapItem read(JsonReader in) throws IOException { + public HistoryActor read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -212,18 +212,18 @@ public AIDecompInverseStringMapItem read(JsonReader in) throws IOException { } /** - * Create an instance of AIDecompInverseStringMapItem given an JSON string + * Create an instance of HistoryActor given an JSON string * * @param jsonString JSON string - * @return An instance of AIDecompInverseStringMapItem - * @throws IOException if the JSON string is invalid with respect to AIDecompInverseStringMapItem + * @return An instance of HistoryActor + * @throws IOException if the JSON string is invalid with respect to HistoryActor */ - public static AIDecompInverseStringMapItem fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AIDecompInverseStringMapItem.class); + public static HistoryActor fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HistoryActor.class); } /** - * Convert an instance of AIDecompInverseStringMapItem to an JSON string + * Convert an instance of HistoryActor to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/LineAttributionsData.java b/src/main/java/ai/reveng/model/LineAttributionsData.java new file mode 100644 index 00000000..1dd8ed16 --- /dev/null +++ b/src/main/java/ai/reveng/model/LineAttributionsData.java @@ -0,0 +1,216 @@ +/* + * 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.List; +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; + +/** + * LineAttributionsData + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class LineAttributionsData { + public static final String SERIALIZED_NAME_DISASSEMBLY_LINE_NUMBER_TO_AI_DECOMPILATION_LINE_NUMBERS = "disassembly_line_number_to_ai_decompilation_line_numbers"; + @SerializedName(SERIALIZED_NAME_DISASSEMBLY_LINE_NUMBER_TO_AI_DECOMPILATION_LINE_NUMBERS) + @javax.annotation.Nonnull + private Map> disassemblyLineNumberToAiDecompilationLineNumbers = new HashMap<>(); + + public LineAttributionsData() { + } + + public LineAttributionsData disassemblyLineNumberToAiDecompilationLineNumbers(@javax.annotation.Nonnull Map> disassemblyLineNumberToAiDecompilationLineNumbers) { + this.disassemblyLineNumberToAiDecompilationLineNumbers = disassemblyLineNumberToAiDecompilationLineNumbers; + return this; + } + + public LineAttributionsData putDisassemblyLineNumberToAiDecompilationLineNumbersItem(String key, List disassemblyLineNumberToAiDecompilationLineNumbersItem) { + if (this.disassemblyLineNumberToAiDecompilationLineNumbers == null) { + this.disassemblyLineNumberToAiDecompilationLineNumbers = new HashMap<>(); + } + this.disassemblyLineNumberToAiDecompilationLineNumbers.put(key, disassemblyLineNumberToAiDecompilationLineNumbersItem); + return this; + } + + /** + * Each disassembly line number mapped to the AI-decompilation line numbers it fed, e.g. {\"12\": [3, 4, 6], \"17\": [4]}. Both sides 0-based; many-to-many in both directions. Empty when no completed run has produced a correspondence, which is ordinary and not an error. + * @return disassemblyLineNumberToAiDecompilationLineNumbers + */ + @javax.annotation.Nonnull + public Map> getDisassemblyLineNumberToAiDecompilationLineNumbers() { + return disassemblyLineNumberToAiDecompilationLineNumbers; + } + + public void setDisassemblyLineNumberToAiDecompilationLineNumbers(@javax.annotation.Nonnull Map> disassemblyLineNumberToAiDecompilationLineNumbers) { + this.disassemblyLineNumberToAiDecompilationLineNumbers = disassemblyLineNumberToAiDecompilationLineNumbers; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LineAttributionsData lineAttributionsData = (LineAttributionsData) o; + return Objects.equals(this.disassemblyLineNumberToAiDecompilationLineNumbers, lineAttributionsData.disassemblyLineNumberToAiDecompilationLineNumbers); + } + + @Override + public int hashCode() { + return Objects.hash(disassemblyLineNumberToAiDecompilationLineNumbers); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LineAttributionsData {\n"); + sb.append(" disassemblyLineNumberToAiDecompilationLineNumbers: ").append(toIndentedString(disassemblyLineNumberToAiDecompilationLineNumbers)).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("disassembly_line_number_to_ai_decompilation_line_numbers")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("disassembly_line_number_to_ai_decompilation_line_numbers")); + } + + /** + * 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 LineAttributionsData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LineAttributionsData.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 LineAttributionsData is not found in the empty JSON string", LineAttributionsData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LineAttributionsData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `LineAttributionsData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LineAttributionsData.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 (!LineAttributionsData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LineAttributionsData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LineAttributionsData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LineAttributionsData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LineAttributionsData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LineAttributionsData given an JSON string + * + * @param jsonString JSON string + * @return An instance of LineAttributionsData + * @throws IOException if the JSON string is invalid with respect to LineAttributionsData + */ + public static LineAttributionsData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LineAttributionsData.class); + } + + /** + * Convert an instance of LineAttributionsData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ListAnalysisFunctionsDataTypesOutputBody.java b/src/main/java/ai/reveng/model/ListAnalysisDataTypesOutputBody.java similarity index 68% rename from src/main/java/ai/reveng/model/ListAnalysisFunctionsDataTypesOutputBody.java rename to src/main/java/ai/reveng/model/ListAnalysisDataTypesOutputBody.java index 301d31bb..90d901e9 100644 --- a/src/main/java/ai/reveng/model/ListAnalysisFunctionsDataTypesOutputBody.java +++ b/src/main/java/ai/reveng/model/ListAnalysisDataTypesOutputBody.java @@ -13,7 +13,7 @@ package ai.reveng.model; import java.util.Objects; -import ai.reveng.model.DataTypesEntry; +import ai.reveng.model.DataTypeEntry; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -48,29 +48,29 @@ import ai.reveng.invoker.JSON; /** - * ListAnalysisFunctionsDataTypesOutputBody + * ListAnalysisDataTypesOutputBody */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ListAnalysisFunctionsDataTypesOutputBody { +public class ListAnalysisDataTypesOutputBody { public static final String SERIALIZED_NAME_ITEMS = "items"; @SerializedName(SERIALIZED_NAME_ITEMS) @javax.annotation.Nullable - private List items; + private List items; public static final String SERIALIZED_NAME_TOTAL_COUNT = "total_count"; @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) @javax.annotation.Nonnull private Long totalCount; - public ListAnalysisFunctionsDataTypesOutputBody() { + public ListAnalysisDataTypesOutputBody() { } - public ListAnalysisFunctionsDataTypesOutputBody items(@javax.annotation.Nullable List items) { + public ListAnalysisDataTypesOutputBody items(@javax.annotation.Nullable List items) { this.items = items; return this; } - public ListAnalysisFunctionsDataTypesOutputBody addItemsItem(DataTypesEntry itemsItem) { + public ListAnalysisDataTypesOutputBody addItemsItem(DataTypeEntry itemsItem) { if (this.items == null) { this.items = new ArrayList<>(); } @@ -83,22 +83,22 @@ public ListAnalysisFunctionsDataTypesOutputBody addItemsItem(DataTypesEntry item * @return items */ @javax.annotation.Nullable - public List getItems() { + public List getItems() { return items; } - public void setItems(@javax.annotation.Nullable List items) { + public void setItems(@javax.annotation.Nullable List items) { this.items = items; } - public ListAnalysisFunctionsDataTypesOutputBody totalCount(@javax.annotation.Nonnull Long totalCount) { + public ListAnalysisDataTypesOutputBody totalCount(@javax.annotation.Nonnull Long totalCount) { this.totalCount = totalCount; return this; } /** - * Total functions in the analysis, ignoring pagination. + * Total types matching the filters, ignoring pagination. * @return totalCount */ @javax.annotation.Nonnull @@ -120,9 +120,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - ListAnalysisFunctionsDataTypesOutputBody listAnalysisFunctionsDataTypesOutputBody = (ListAnalysisFunctionsDataTypesOutputBody) o; - return Objects.equals(this.items, listAnalysisFunctionsDataTypesOutputBody.items) && - Objects.equals(this.totalCount, listAnalysisFunctionsDataTypesOutputBody.totalCount); + ListAnalysisDataTypesOutputBody listAnalysisDataTypesOutputBody = (ListAnalysisDataTypesOutputBody) o; + return Objects.equals(this.items, listAnalysisDataTypesOutputBody.items) && + Objects.equals(this.totalCount, listAnalysisDataTypesOutputBody.totalCount); } @Override @@ -133,7 +133,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class ListAnalysisFunctionsDataTypesOutputBody {\n"); + sb.append("class ListAnalysisDataTypesOutputBody {\n"); sb.append(" items: ").append(toIndentedString(items)).append("\n"); sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); sb.append("}"); @@ -164,25 +164,25 @@ private String toIndentedString(Object o) { * 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 ListAnalysisFunctionsDataTypesOutputBody + * @throws IOException if the JSON Element is invalid with respect to ListAnalysisDataTypesOutputBody */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!ListAnalysisFunctionsDataTypesOutputBody.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 ListAnalysisFunctionsDataTypesOutputBody is not found in the empty JSON string", ListAnalysisFunctionsDataTypesOutputBody.openapiRequiredFields.toString())); + if (!ListAnalysisDataTypesOutputBody.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 ListAnalysisDataTypesOutputBody is not found in the empty JSON string", ListAnalysisDataTypesOutputBody.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!ListAnalysisFunctionsDataTypesOutputBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ListAnalysisFunctionsDataTypesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!ListAnalysisDataTypesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ListAnalysisDataTypesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ListAnalysisFunctionsDataTypesOutputBody.openapiRequiredFields) { + for (String requiredField : ListAnalysisDataTypesOutputBody.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())); } @@ -195,7 +195,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); // validate the required field `items` (array) for (int i = 0; i < jsonArrayitems.size(); i++) { - DataTypesEntry.validateJsonElement(jsonArrayitems.get(i)); + DataTypeEntry.validateJsonElement(jsonArrayitems.get(i)); } } } @@ -204,22 +204,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!ListAnalysisFunctionsDataTypesOutputBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ListAnalysisFunctionsDataTypesOutputBody' and its subtypes + if (!ListAnalysisDataTypesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListAnalysisDataTypesOutputBody' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ListAnalysisFunctionsDataTypesOutputBody.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListAnalysisDataTypesOutputBody.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, ListAnalysisFunctionsDataTypesOutputBody value) throws IOException { + public void write(JsonWriter out, ListAnalysisDataTypesOutputBody value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public ListAnalysisFunctionsDataTypesOutputBody read(JsonReader in) throws IOException { + public ListAnalysisDataTypesOutputBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -230,18 +230,18 @@ public ListAnalysisFunctionsDataTypesOutputBody read(JsonReader in) throws IOExc } /** - * Create an instance of ListAnalysisFunctionsDataTypesOutputBody given an JSON string + * Create an instance of ListAnalysisDataTypesOutputBody given an JSON string * * @param jsonString JSON string - * @return An instance of ListAnalysisFunctionsDataTypesOutputBody - * @throws IOException if the JSON string is invalid with respect to ListAnalysisFunctionsDataTypesOutputBody + * @return An instance of ListAnalysisDataTypesOutputBody + * @throws IOException if the JSON string is invalid with respect to ListAnalysisDataTypesOutputBody */ - public static ListAnalysisFunctionsDataTypesOutputBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ListAnalysisFunctionsDataTypesOutputBody.class); + public static ListAnalysisDataTypesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListAnalysisDataTypesOutputBody.class); } /** - * Convert an instance of ListAnalysisFunctionsDataTypesOutputBody to an JSON string + * Convert an instance of ListAnalysisDataTypesOutputBody to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/UpdateDataTypesOutputBody.java b/src/main/java/ai/reveng/model/ListDataTypeFunctionsBody.java similarity index 54% rename from src/main/java/ai/reveng/model/UpdateDataTypesOutputBody.java rename to src/main/java/ai/reveng/model/ListDataTypeFunctionsBody.java index 07874d0d..3a150e66 100644 --- a/src/main/java/ai/reveng/model/UpdateDataTypesOutputBody.java +++ b/src/main/java/ai/reveng/model/ListDataTypeFunctionsBody.java @@ -13,13 +13,16 @@ package ai.reveng.model; import java.util.Objects; +import ai.reveng.model.DataTypeFunctionEntry; 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; @@ -45,82 +48,66 @@ import ai.reveng.invoker.JSON; /** - * UpdateDataTypesOutputBody + * ListDataTypeFunctionsBody */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class UpdateDataTypesOutputBody { - public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES) - @javax.annotation.Nullable - private Object dataTypes = null; - - public static final String SERIALIZED_NAME_DATA_TYPES_VERSION = "data_types_version"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_VERSION) +public class ListDataTypeFunctionsBody { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) @javax.annotation.Nonnull - private Long dataTypesVersion; + private List items = new ArrayList<>(); - public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; - @SerializedName(SERIALIZED_NAME_FUNCTION_ID) - @javax.annotation.Nonnull - private Long functionId; + public static final String SERIALIZED_NAME_NEXT_AFTER_FUNCTION_ID = "next_after_function_id"; + @SerializedName(SERIALIZED_NAME_NEXT_AFTER_FUNCTION_ID) + @javax.annotation.Nullable + private Long nextAfterFunctionId; - public UpdateDataTypesOutputBody() { + public ListDataTypeFunctionsBody() { } - public UpdateDataTypesOutputBody dataTypes(@javax.annotation.Nullable Object dataTypes) { - this.dataTypes = dataTypes; + public ListDataTypeFunctionsBody items(@javax.annotation.Nonnull List items) { + this.items = items; return this; } - /** - * Get dataTypes - * @return dataTypes - */ - @javax.annotation.Nullable - public Object getDataTypes() { - return dataTypes; - } - - public void setDataTypes(@javax.annotation.Nullable Object dataTypes) { - this.dataTypes = dataTypes; - } - - - public UpdateDataTypesOutputBody dataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; + public ListDataTypeFunctionsBody addItemsItem(DataTypeFunctionEntry itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); return this; } /** - * Version of the stored function data types after the update - * @return dataTypesVersion + * The page of matching functions, in ascending function ID order. Empty when no function uses the type. + * @return items */ @javax.annotation.Nonnull - public Long getDataTypesVersion() { - return dataTypesVersion; + public List getItems() { + return items; } - public void setDataTypesVersion(@javax.annotation.Nonnull Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; + public void setItems(@javax.annotation.Nonnull List items) { + this.items = items; } - public UpdateDataTypesOutputBody functionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; + public ListDataTypeFunctionsBody nextAfterFunctionId(@javax.annotation.Nullable Long nextAfterFunctionId) { + this.nextAfterFunctionId = nextAfterFunctionId; return this; } /** - * Function ID - * @return functionId + * Pass as after_function_id to fetch the next page. Absent on the last page. + * @return nextAfterFunctionId */ - @javax.annotation.Nonnull - public Long getFunctionId() { - return functionId; + @javax.annotation.Nullable + public Long getNextAfterFunctionId() { + return nextAfterFunctionId; } - public void setFunctionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; + public void setNextAfterFunctionId(@javax.annotation.Nullable Long nextAfterFunctionId) { + this.nextAfterFunctionId = nextAfterFunctionId; } @@ -133,24 +120,22 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - UpdateDataTypesOutputBody updateDataTypesOutputBody = (UpdateDataTypesOutputBody) o; - return Objects.equals(this.dataTypes, updateDataTypesOutputBody.dataTypes) && - Objects.equals(this.dataTypesVersion, updateDataTypesOutputBody.dataTypesVersion) && - Objects.equals(this.functionId, updateDataTypesOutputBody.functionId); + ListDataTypeFunctionsBody listDataTypeFunctionsBody = (ListDataTypeFunctionsBody) o; + return Objects.equals(this.items, listDataTypeFunctionsBody.items) && + Objects.equals(this.nextAfterFunctionId, listDataTypeFunctionsBody.nextAfterFunctionId); } @Override public int hashCode() { - return Objects.hash(dataTypes, dataTypesVersion, functionId); + return Objects.hash(items, nextAfterFunctionId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class UpdateDataTypesOutputBody {\n"); - sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); - sb.append(" dataTypesVersion: ").append(toIndentedString(dataTypesVersion)).append("\n"); - sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append("class ListDataTypeFunctionsBody {\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" nextAfterFunctionId: ").append(toIndentedString(nextAfterFunctionId)).append("\n"); sb.append("}"); return sb.toString(); } @@ -169,62 +154,72 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("data_types", "data_types_version", "function_id")); + openapiFields = new HashSet(Arrays.asList("items", "next_after_function_id")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("data_types", "data_types_version", "function_id")); + openapiRequiredFields = new HashSet(Arrays.asList("items")); } /** * 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 UpdateDataTypesOutputBody + * @throws IOException if the JSON Element is invalid with respect to ListDataTypeFunctionsBody */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!UpdateDataTypesOutputBody.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 UpdateDataTypesOutputBody is not found in the empty JSON string", UpdateDataTypesOutputBody.openapiRequiredFields.toString())); + if (!ListDataTypeFunctionsBody.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 ListDataTypeFunctionsBody is not found in the empty JSON string", ListDataTypeFunctionsBody.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!UpdateDataTypesOutputBody.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateDataTypesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!ListDataTypeFunctionsBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ListDataTypeFunctionsBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateDataTypesOutputBody.openapiRequiredFields) { + for (String requiredField : ListDataTypeFunctionsBody.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("items") != null) { + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + DataTypeFunctionEntry.validateJsonElement(jsonArrayitems.get(i)); + } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateDataTypesOutputBody.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateDataTypesOutputBody' and its subtypes + if (!ListDataTypeFunctionsBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListDataTypeFunctionsBody' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(UpdateDataTypesOutputBody.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListDataTypeFunctionsBody.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, UpdateDataTypesOutputBody value) throws IOException { + public void write(JsonWriter out, ListDataTypeFunctionsBody value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public UpdateDataTypesOutputBody read(JsonReader in) throws IOException { + public ListDataTypeFunctionsBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -235,18 +230,18 @@ public UpdateDataTypesOutputBody read(JsonReader in) throws IOException { } /** - * Create an instance of UpdateDataTypesOutputBody given an JSON string + * Create an instance of ListDataTypeFunctionsBody given an JSON string * * @param jsonString JSON string - * @return An instance of UpdateDataTypesOutputBody - * @throws IOException if the JSON string is invalid with respect to UpdateDataTypesOutputBody + * @return An instance of ListDataTypeFunctionsBody + * @throws IOException if the JSON string is invalid with respect to ListDataTypeFunctionsBody */ - public static UpdateDataTypesOutputBody fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateDataTypesOutputBody.class); + public static ListDataTypeFunctionsBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListDataTypeFunctionsBody.class); } /** - * Convert an instance of UpdateDataTypesOutputBody to an JSON string + * Convert an instance of ListDataTypeFunctionsBody to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/ListFunctionSignaturesOutputBody.java b/src/main/java/ai/reveng/model/ListFunctionSignaturesOutputBody.java new file mode 100644 index 00000000..e8ec36d1 --- /dev/null +++ b/src/main/java/ai/reveng/model/ListFunctionSignaturesOutputBody.java @@ -0,0 +1,287 @@ +/* + * 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.AnalysisDataTypesGroup; +import ai.reveng.model.BatchFunctionSignatureEntry; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * ListFunctionSignaturesOutputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ListFunctionSignaturesOutputBody { + public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; + @SerializedName(SERIALIZED_NAME_DATA_TYPES) + @javax.annotation.Nullable + private List dataTypes; + + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items; + + public ListFunctionSignaturesOutputBody() { + } + + public ListFunctionSignaturesOutputBody dataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + public ListFunctionSignaturesOutputBody addDataTypesItem(AnalysisDataTypesGroup dataTypesItem) { + if (this.dataTypes == null) { + this.dataTypes = new ArrayList<>(); + } + this.dataTypes.add(dataTypesItem); + return this; + } + + /** + * The types the returned signatures name, grouped by analysis and ordered by analysis_id. Returned only when include_data_types is true. + * @return dataTypes + */ + @javax.annotation.Nullable + public List getDataTypes() { + return dataTypes; + } + + public void setDataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + } + + + public ListFunctionSignaturesOutputBody items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public ListFunctionSignaturesOutputBody addItemsItem(BatchFunctionSignatureEntry itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * One entry per distinct requested function ID, in request order. A repeated ID yields one entry. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListFunctionSignaturesOutputBody listFunctionSignaturesOutputBody = (ListFunctionSignaturesOutputBody) o; + return Objects.equals(this.dataTypes, listFunctionSignaturesOutputBody.dataTypes) && + Objects.equals(this.items, listFunctionSignaturesOutputBody.items); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypes, items); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListFunctionSignaturesOutputBody {\n"); + sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_types", "items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("items")); + } + + /** + * 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 ListFunctionSignaturesOutputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListFunctionSignaturesOutputBody.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 ListFunctionSignaturesOutputBody is not found in the empty JSON string", ListFunctionSignaturesOutputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ListFunctionSignaturesOutputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ListFunctionSignaturesOutputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ListFunctionSignaturesOutputBody.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("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { + JsonArray jsonArraydataTypes = jsonObj.getAsJsonArray("data_types"); + if (jsonArraydataTypes != null) { + // ensure the json data is an array + if (!jsonObj.get("data_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data_types` to be an array in the JSON string but got `%s`", jsonObj.get("data_types").toString())); + } + + // validate the optional field `data_types` (array) + for (int i = 0; i < jsonArraydataTypes.size(); i++) { + AnalysisDataTypesGroup.validateJsonElement(jsonArraydataTypes.get(i)); + }; + } + } + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + BatchFunctionSignatureEntry.validateJsonElement(jsonArrayitems.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListFunctionSignaturesOutputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListFunctionSignaturesOutputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListFunctionSignaturesOutputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListFunctionSignaturesOutputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ListFunctionSignaturesOutputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListFunctionSignaturesOutputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListFunctionSignaturesOutputBody + * @throws IOException if the JSON string is invalid with respect to ListFunctionSignaturesOutputBody + */ + public static ListFunctionSignaturesOutputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListFunctionSignaturesOutputBody.class); + } + + /** + * Convert an instance of ListFunctionSignaturesOutputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/MatchFilters.java b/src/main/java/ai/reveng/model/MatchFilters.java index ecbd69d3..b6afc387 100644 --- a/src/main/java/ai/reveng/model/MatchFilters.java +++ b/src/main/java/ai/reveng/model/MatchFilters.java @@ -53,21 +53,21 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class MatchFilters { /** - * Restrict matches to this architecture (multi-platform models only; matches all architectures if omitted). Rejected for single-architecture models. + * Gets or Sets architectures */ - @JsonAdapter(ArchEnum.Adapter.class) - public enum ArchEnum { - X86("x86"), + @JsonAdapter(ArchitecturesEnum.Adapter.class) + public enum ArchitecturesEnum { + X86_64("x86_64"), - ARM("arm"), + X86_32("x86_32"), - UNKNOWN("unknown"), + ARM_64("arm_64"), UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); private String value; - ArchEnum(String value) { + ArchitecturesEnum(String value) { this.value = value; } @@ -80,8 +80,8 @@ public String toString() { return String.valueOf(value); } - public static ArchEnum fromValue(String value) { - for (ArchEnum b : ArchEnum.values()) { + public static ArchitecturesEnum fromValue(String value) { + for (ArchitecturesEnum b : ArchitecturesEnum.values()) { if (b.value.equals(value)) { return b; } @@ -89,45 +89,45 @@ public static ArchEnum fromValue(String value) { return UNKNOWN_DEFAULT_OPEN_API; } - public static class Adapter extends TypeAdapter { + public static class Adapter extends TypeAdapter { @Override - public void write(final JsonWriter jsonWriter, final ArchEnum enumeration) throws IOException { + public void write(final JsonWriter jsonWriter, final ArchitecturesEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public ArchEnum read(final JsonReader jsonReader) throws IOException { + public ArchitecturesEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); - return ArchEnum.fromValue(value); + return ArchitecturesEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); - ArchEnum.fromValue(value); + ArchitecturesEnum.fromValue(value); } } - public static final String SERIALIZED_NAME_ARCH = "arch"; - @SerializedName(SERIALIZED_NAME_ARCH) + public static final String SERIALIZED_NAME_ARCHITECTURES = "architectures"; + @SerializedName(SERIALIZED_NAME_ARCHITECTURES) @javax.annotation.Nullable - private ArchEnum arch; + private List architectures; public static final String SERIALIZED_NAME_BINARY_IDS = "binary_ids"; @SerializedName(SERIALIZED_NAME_BINARY_IDS) @javax.annotation.Nullable private List binaryIds; - public static final String SERIALIZED_NAME_BITS = "bits"; - @SerializedName(SERIALIZED_NAME_BITS) - @javax.annotation.Nullable - private Long bits; - public static final String SERIALIZED_NAME_COLLECTION_IDS = "collection_ids"; @SerializedName(SERIALIZED_NAME_COLLECTION_IDS) @javax.annotation.Nullable private List collectionIds; + public static final String SERIALIZED_NAME_DEBUG = "debug"; + @SerializedName(SERIALIZED_NAME_DEBUG) + @javax.annotation.Nullable + private Boolean debug; + public static final String SERIALIZED_NAME_DEBUG_TYPES = "debug_types"; @SerializedName(SERIALIZED_NAME_DEBUG_TYPES) @javax.annotation.Nullable @@ -138,26 +138,27 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nullable private List functionIds; + public static final String SERIALIZED_NAME_INCLUDE_USER_DEBUG = "include_user_debug"; + @SerializedName(SERIALIZED_NAME_INCLUDE_USER_DEBUG) + @javax.annotation.Nullable + private Boolean includeUserDebug; + /** - * Restrict matches to this platform (multi-platform models only; matches all platforms if omitted). Rejected for single-architecture models. + * Gets or Sets platforms */ - @JsonAdapter(PlatformEnum.Adapter.class) - public enum PlatformEnum { - LINUX("linux"), - + @JsonAdapter(PlatformsEnum.Adapter.class) + public enum PlatformsEnum { WINDOWS("windows"), - ANDROID("android"), - - MACOS("macos"), + LINUX("linux"), - UNKNOWN("unknown"), + ANDROID("android"), UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); private String value; - PlatformEnum(String value) { + PlatformsEnum(String value) { this.value = value; } @@ -170,8 +171,8 @@ public String toString() { return String.valueOf(value); } - public static PlatformEnum fromValue(String value) { - for (PlatformEnum b : PlatformEnum.values()) { + public static PlatformsEnum fromValue(String value) { + for (PlatformsEnum b : PlatformsEnum.values()) { if (b.value.equals(value)) { return b; } @@ -179,29 +180,29 @@ public static PlatformEnum fromValue(String value) { return UNKNOWN_DEFAULT_OPEN_API; } - public static class Adapter extends TypeAdapter { + public static class Adapter extends TypeAdapter { @Override - public void write(final JsonWriter jsonWriter, final PlatformEnum enumeration) throws IOException { + public void write(final JsonWriter jsonWriter, final PlatformsEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public PlatformEnum read(final JsonReader jsonReader) throws IOException { + public PlatformsEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); - return PlatformEnum.fromValue(value); + return PlatformsEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); - PlatformEnum.fromValue(value); + PlatformsEnum.fromValue(value); } } - public static final String SERIALIZED_NAME_PLATFORM = "platform"; - @SerializedName(SERIALIZED_NAME_PLATFORM) + public static final String SERIALIZED_NAME_PLATFORMS = "platforms"; + @SerializedName(SERIALIZED_NAME_PLATFORMS) @javax.annotation.Nullable - private PlatformEnum platform; + private List platforms; public static final String SERIALIZED_NAME_USER_IDS = "user_ids"; @SerializedName(SERIALIZED_NAME_USER_IDS) @@ -211,22 +212,30 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti public MatchFilters() { } - public MatchFilters arch(@javax.annotation.Nullable ArchEnum arch) { - this.arch = arch; + public MatchFilters architectures(@javax.annotation.Nullable List architectures) { + this.architectures = architectures; + return this; + } + + public MatchFilters addArchitecturesItem(ArchitecturesEnum architecturesItem) { + if (this.architectures == null) { + this.architectures = new ArrayList<>(); + } + this.architectures.add(architecturesItem); return this; } /** - * Restrict matches to this architecture (multi-platform models only; matches all architectures if omitted). Rejected for single-architecture models. - * @return arch + * Restrict matches to candidates whose binary was detected as one of these architectures. Word size is part of the value, so there is no separate bits filter. Matches all architectures if omitted. + * @return architectures */ @javax.annotation.Nullable - public ArchEnum getArch() { - return arch; + public List getArchitectures() { + return architectures; } - public void setArch(@javax.annotation.Nullable ArchEnum arch) { - this.arch = arch; + public void setArchitectures(@javax.annotation.Nullable List architectures) { + this.architectures = architectures; } @@ -257,25 +266,6 @@ public void setBinaryIds(@javax.annotation.Nullable List binaryIds) { } - public MatchFilters bits(@javax.annotation.Nullable Long bits) { - this.bits = bits; - return this; - } - - /** - * Restrict matches to this word size (multi-platform models only). Rejected for single-architecture models. - * @return bits - */ - @javax.annotation.Nullable - public Long getBits() { - return bits; - } - - public void setBits(@javax.annotation.Nullable Long bits) { - this.bits = bits; - } - - public MatchFilters collectionIds(@javax.annotation.Nullable List collectionIds) { this.collectionIds = collectionIds; return this; @@ -303,6 +293,25 @@ public void setCollectionIds(@javax.annotation.Nullable List collectionIds } + public MatchFilters debug(@javax.annotation.Nullable Boolean debug) { + this.debug = debug; + return this; + } + + /** + * Restrict matches to candidates with auto/system debug symbols. Multi-platform models only; rejected for single-architecture models. + * @return debug + */ + @javax.annotation.Nullable + public Boolean getDebug() { + return debug; + } + + public void setDebug(@javax.annotation.Nullable Boolean debug) { + this.debug = debug; + } + + public MatchFilters debugTypes(@javax.annotation.Nullable List debugTypes) { this.debugTypes = debugTypes; return this; @@ -357,22 +366,49 @@ public void setFunctionIds(@javax.annotation.Nullable List functionIds) { } - public MatchFilters platform(@javax.annotation.Nullable PlatformEnum platform) { - this.platform = platform; + public MatchFilters includeUserDebug(@javax.annotation.Nullable Boolean includeUserDebug) { + this.includeUserDebug = includeUserDebug; + return this; + } + + /** + * When debug is set, also match user-named functions (not only auto/system debug). No effect unless debug is true. + * @return includeUserDebug + */ + @javax.annotation.Nullable + public Boolean getIncludeUserDebug() { + return includeUserDebug; + } + + public void setIncludeUserDebug(@javax.annotation.Nullable Boolean includeUserDebug) { + this.includeUserDebug = includeUserDebug; + } + + + public MatchFilters platforms(@javax.annotation.Nullable List platforms) { + this.platforms = platforms; + return this; + } + + public MatchFilters addPlatformsItem(PlatformsEnum platformsItem) { + if (this.platforms == null) { + this.platforms = new ArrayList<>(); + } + this.platforms.add(platformsItem); return this; } /** - * Restrict matches to this platform (multi-platform models only; matches all platforms if omitted). Rejected for single-architecture models. - * @return platform + * Restrict matches to candidates whose binary was detected as one of these platforms. Matches all platforms if omitted; a binary whose detection has not run is never matched by a non-empty filter. + * @return platforms */ @javax.annotation.Nullable - public PlatformEnum getPlatform() { - return platform; + public List getPlatforms() { + return platforms; } - public void setPlatform(@javax.annotation.Nullable PlatformEnum platform) { - this.platform = platform; + public void setPlatforms(@javax.annotation.Nullable List platforms) { + this.platforms = platforms; } @@ -402,6 +438,50 @@ public void setUserIds(@javax.annotation.Nullable List userIds) { this.userIds = userIds; } + /** + * 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 MatchFilters instance itself + */ + public MatchFilters 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 @@ -413,14 +493,16 @@ public boolean equals(Object o) { return false; } MatchFilters matchFilters = (MatchFilters) o; - return Objects.equals(this.arch, matchFilters.arch) && + return Objects.equals(this.architectures, matchFilters.architectures) && Objects.equals(this.binaryIds, matchFilters.binaryIds) && - Objects.equals(this.bits, matchFilters.bits) && Objects.equals(this.collectionIds, matchFilters.collectionIds) && + Objects.equals(this.debug, matchFilters.debug) && Objects.equals(this.debugTypes, matchFilters.debugTypes) && Objects.equals(this.functionIds, matchFilters.functionIds) && - Objects.equals(this.platform, matchFilters.platform) && - Objects.equals(this.userIds, matchFilters.userIds); + Objects.equals(this.includeUserDebug, matchFilters.includeUserDebug) && + Objects.equals(this.platforms, matchFilters.platforms) && + Objects.equals(this.userIds, matchFilters.userIds)&& + Objects.equals(this.additionalProperties, matchFilters.additionalProperties); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -429,7 +511,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(arch, binaryIds, bits, collectionIds, debugTypes, functionIds, platform, userIds); + return Objects.hash(architectures, binaryIds, collectionIds, debug, debugTypes, functionIds, includeUserDebug, platforms, userIds, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -443,14 +525,16 @@ private static int hashCodeNullable(JsonNullable a) { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class MatchFilters {\n"); - sb.append(" arch: ").append(toIndentedString(arch)).append("\n"); + sb.append(" architectures: ").append(toIndentedString(architectures)).append("\n"); sb.append(" binaryIds: ").append(toIndentedString(binaryIds)).append("\n"); - sb.append(" bits: ").append(toIndentedString(bits)).append("\n"); sb.append(" collectionIds: ").append(toIndentedString(collectionIds)).append("\n"); + sb.append(" debug: ").append(toIndentedString(debug)).append("\n"); sb.append(" debugTypes: ").append(toIndentedString(debugTypes)).append("\n"); sb.append(" functionIds: ").append(toIndentedString(functionIds)).append("\n"); - sb.append(" platform: ").append(toIndentedString(platform)).append("\n"); + sb.append(" includeUserDebug: ").append(toIndentedString(includeUserDebug)).append("\n"); + sb.append(" platforms: ").append(toIndentedString(platforms)).append("\n"); sb.append(" userIds: ").append(toIndentedString(userIds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -469,7 +553,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("arch", "binary_ids", "bits", "collection_ids", "debug_types", "function_ids", "platform", "user_ids")); + openapiFields = new HashSet(Arrays.asList("architectures", "binary_ids", "collection_ids", "debug", "debug_types", "function_ids", "include_user_debug", "platforms", "user_ids")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); @@ -487,21 +571,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in MatchFilters is not found in the empty JSON string", MatchFilters.openapiRequiredFields.toString())); } } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MatchFilters.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `MatchFilters` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("arch") != null && !jsonObj.get("arch").isJsonNull()) && !jsonObj.get("arch").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `arch` to be a primitive type in the JSON string but got `%s`", jsonObj.get("arch").toString())); - } - // validate the optional field `arch` - if (jsonObj.get("arch") != null && !jsonObj.get("arch").isJsonNull()) { - ArchEnum.validateJsonElement(jsonObj.get("arch")); + // ensure the optional json data is an array if present + if (jsonObj.get("architectures") != null && !jsonObj.get("architectures").isJsonNull() && !jsonObj.get("architectures").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `architectures` to be an array in the JSON string but got `%s`", jsonObj.get("architectures").toString())); } // ensure the optional json data is an array if present if (jsonObj.get("binary_ids") != null && !jsonObj.get("binary_ids").isJsonNull() && !jsonObj.get("binary_ids").isJsonArray()) { @@ -519,12 +592,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("function_ids") != null && !jsonObj.get("function_ids").isJsonNull() && !jsonObj.get("function_ids").isJsonArray()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `function_ids` to be an array in the JSON string but got `%s`", jsonObj.get("function_ids").toString())); } - if ((jsonObj.get("platform") != null && !jsonObj.get("platform").isJsonNull()) && !jsonObj.get("platform").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `platform` to be a primitive type in the JSON string but got `%s`", jsonObj.get("platform").toString())); - } - // validate the optional field `platform` - if (jsonObj.get("platform") != null && !jsonObj.get("platform").isJsonNull()) { - PlatformEnum.validateJsonElement(jsonObj.get("platform")); + // ensure the optional json data is an array if present + if (jsonObj.get("platforms") != null && !jsonObj.get("platforms").isJsonNull() && !jsonObj.get("platforms").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `platforms` to be an array in the JSON string but got `%s`", jsonObj.get("platforms").toString())); } // ensure the optional json data is an array if present if (jsonObj.get("user_ids") != null && !jsonObj.get("user_ids").isJsonNull() && !jsonObj.get("user_ids").isJsonArray()) { @@ -547,6 +617,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, MatchFilters 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); } @@ -554,7 +646,28 @@ public void write(JsonWriter out, MatchFilters value) throws IOException { public MatchFilters read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MatchFilters 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(); diff --git a/src/main/java/ai/reveng/model/PointerDataType.java b/src/main/java/ai/reveng/model/PointerDataType.java new file mode 100644 index 00000000..00e18f06 --- /dev/null +++ b/src/main/java/ai/reveng/model/PointerDataType.java @@ -0,0 +1,571 @@ +/* + * 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.PointerDefinition; +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; + +/** + * PointerDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PointerDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private PointerDefinition definition; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + POINTER("POINTER"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public PointerDataType() { + } + + public PointerDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public PointerDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public PointerDataType definition(@javax.annotation.Nullable PointerDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Absent only for a type referenced but never defined. + * @return definition + */ + @javax.annotation.Nullable + public PointerDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable PointerDefinition definition) { + this.definition = definition; + } + + + public PointerDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public PointerDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public PointerDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public PointerDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public PointerDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public PointerDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public PointerDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PointerDataType pointerDataType = (PointerDataType) o; + return Objects.equals(this.createdAt, pointerDataType.createdAt) && + Objects.equals(this.dataTypeId, pointerDataType.dataTypeId) && + Objects.equals(this.definition, pointerDataType.definition) && + Objects.equals(this.hasDefinition, pointerDataType.hasDefinition) && + Objects.equals(this.kind, pointerDataType.kind) && + Objects.equals(this.name, pointerDataType.name) && + Objects.equals(this.namespace, pointerDataType.namespace) && + Objects.equals(this.size, pointerDataType.size) && + Objects.equals(this.sourceFunctionId, pointerDataType.sourceFunctionId) && + Objects.equals(this.sourceType, pointerDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, definition, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PointerDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "definition", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PointerDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PointerDataType.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 PointerDataType is not found in the empty JSON string", PointerDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PointerDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `PointerDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PointerDataType.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(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + PointerDefinition.validateJsonElement(jsonObj.get("definition")); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PointerDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PointerDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PointerDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PointerDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PointerDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PointerDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of PointerDataType + * @throws IOException if the JSON string is invalid with respect to PointerDataType + */ + public static PointerDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PointerDataType.class); + } + + /** + * Convert an instance of PointerDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/PointerDefinition.java b/src/main/java/ai/reveng/model/PointerDefinition.java new file mode 100644 index 00000000..e3f893b4 --- /dev/null +++ b/src/main/java/ai/reveng/model/PointerDefinition.java @@ -0,0 +1,198 @@ +/* + * 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; + +/** + * PointerDefinition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class PointerDefinition { + public static final String SERIALIZED_NAME_POINTEE_DATA_TYPE_ID = "pointee_data_type_id"; + @SerializedName(SERIALIZED_NAME_POINTEE_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long pointeeDataTypeId; + + public PointerDefinition() { + } + + public PointerDefinition pointeeDataTypeId(@javax.annotation.Nullable Long pointeeDataTypeId) { + this.pointeeDataTypeId = pointeeDataTypeId; + return this; + } + + /** + * The type pointed at. + * @return pointeeDataTypeId + */ + @javax.annotation.Nullable + public Long getPointeeDataTypeId() { + return pointeeDataTypeId; + } + + public void setPointeeDataTypeId(@javax.annotation.Nullable Long pointeeDataTypeId) { + this.pointeeDataTypeId = pointeeDataTypeId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PointerDefinition pointerDefinition = (PointerDefinition) o; + return Objects.equals(this.pointeeDataTypeId, pointerDefinition.pointeeDataTypeId); + } + + @Override + public int hashCode() { + return Objects.hash(pointeeDataTypeId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PointerDefinition {\n"); + sb.append(" pointeeDataTypeId: ").append(toIndentedString(pointeeDataTypeId)).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("pointee_data_type_id")); + + // 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 PointerDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PointerDefinition.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 PointerDefinition is not found in the empty JSON string", PointerDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PointerDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `PointerDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PointerDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PointerDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PointerDefinition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PointerDefinition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PointerDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PointerDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of PointerDefinition + * @throws IOException if the JSON string is invalid with respect to PointerDefinition + */ + public static PointerDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PointerDefinition.class); + } + + /** + * Convert an instance of PointerDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/RenameUnnamedFunctionsResult.java b/src/main/java/ai/reveng/model/RenameUnnamedFunctionsResult.java new file mode 100644 index 00000000..872e8329 --- /dev/null +++ b/src/main/java/ai/reveng/model/RenameUnnamedFunctionsResult.java @@ -0,0 +1,309 @@ +/* + * 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; + +/** + * RenameUnnamedFunctionsResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RenameUnnamedFunctionsResult { + public static final String SERIALIZED_NAME_ANALYSIS_ID = "analysis_id"; + @SerializedName(SERIALIZED_NAME_ANALYSIS_ID) + @javax.annotation.Nonnull + private Long analysisId; + + public static final String SERIALIZED_NAME_FAILED = "failed"; + @SerializedName(SERIALIZED_NAME_FAILED) + @javax.annotation.Nonnull + private Long failed; + + public static final String SERIALIZED_NAME_RENAMED = "renamed"; + @SerializedName(SERIALIZED_NAME_RENAMED) + @javax.annotation.Nonnull + private Long renamed; + + public static final String SERIALIZED_NAME_SKIPPED = "skipped"; + @SerializedName(SERIALIZED_NAME_SKIPPED) + @javax.annotation.Nonnull + private Long skipped; + + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nonnull + private Long total; + + public RenameUnnamedFunctionsResult() { + } + + public RenameUnnamedFunctionsResult analysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + return this; + } + + /** + * Analysis the run was performed against + * @return analysisId + */ + @javax.annotation.Nonnull + public Long getAnalysisId() { + return analysisId; + } + + public void setAnalysisId(@javax.annotation.Nonnull Long analysisId) { + this.analysisId = analysisId; + } + + + public RenameUnnamedFunctionsResult failed(@javax.annotation.Nonnull Long failed) { + this.failed = failed; + return this; + } + + /** + * Functions whose rename attempt errored + * @return failed + */ + @javax.annotation.Nonnull + public Long getFailed() { + return failed; + } + + public void setFailed(@javax.annotation.Nonnull Long failed) { + this.failed = failed; + } + + + public RenameUnnamedFunctionsResult renamed(@javax.annotation.Nonnull Long renamed) { + this.renamed = renamed; + return this; + } + + /** + * Functions successfully renamed + * @return renamed + */ + @javax.annotation.Nonnull + public Long getRenamed() { + return renamed; + } + + public void setRenamed(@javax.annotation.Nonnull Long renamed) { + this.renamed = renamed; + } + + + public RenameUnnamedFunctionsResult skipped(@javax.annotation.Nonnull Long skipped) { + this.skipped = skipped; + return this; + } + + /** + * Functions the agent chose not to rename + * @return skipped + */ + @javax.annotation.Nonnull + public Long getSkipped() { + return skipped; + } + + public void setSkipped(@javax.annotation.Nonnull Long skipped) { + this.skipped = skipped; + } + + + public RenameUnnamedFunctionsResult total(@javax.annotation.Nonnull Long total) { + this.total = total; + return this; + } + + /** + * Unnamed functions the run considered + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nonnull Long total) { + this.total = total; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenameUnnamedFunctionsResult renameUnnamedFunctionsResult = (RenameUnnamedFunctionsResult) o; + return Objects.equals(this.analysisId, renameUnnamedFunctionsResult.analysisId) && + Objects.equals(this.failed, renameUnnamedFunctionsResult.failed) && + Objects.equals(this.renamed, renameUnnamedFunctionsResult.renamed) && + Objects.equals(this.skipped, renameUnnamedFunctionsResult.skipped) && + Objects.equals(this.total, renameUnnamedFunctionsResult.total); + } + + @Override + public int hashCode() { + return Objects.hash(analysisId, failed, renamed, skipped, total); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenameUnnamedFunctionsResult {\n"); + sb.append(" analysisId: ").append(toIndentedString(analysisId)).append("\n"); + sb.append(" failed: ").append(toIndentedString(failed)).append("\n"); + sb.append(" renamed: ").append(toIndentedString(renamed)).append("\n"); + sb.append(" skipped: ").append(toIndentedString(skipped)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("analysis_id", "failed", "renamed", "skipped", "total")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("analysis_id", "failed", "renamed", "skipped", "total")); + } + + /** + * 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 RenameUnnamedFunctionsResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RenameUnnamedFunctionsResult.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 RenameUnnamedFunctionsResult is not found in the empty JSON string", RenameUnnamedFunctionsResult.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RenameUnnamedFunctionsResult.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `RenameUnnamedFunctionsResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RenameUnnamedFunctionsResult.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 (!RenameUnnamedFunctionsResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RenameUnnamedFunctionsResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RenameUnnamedFunctionsResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RenameUnnamedFunctionsResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RenameUnnamedFunctionsResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RenameUnnamedFunctionsResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of RenameUnnamedFunctionsResult + * @throws IOException if the JSON string is invalid with respect to RenameUnnamedFunctionsResult + */ + public static RenameUnnamedFunctionsResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RenameUnnamedFunctionsResult.class); + } + + /** + * Convert an instance of RenameUnnamedFunctionsResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/RenderedToken.java b/src/main/java/ai/reveng/model/RenderedToken.java new file mode 100644 index 00000000..f8a46dd3 --- /dev/null +++ b/src/main/java/ai/reveng/model/RenderedToken.java @@ -0,0 +1,417 @@ +/* + * 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; + +/** + * RenderedToken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class RenderedToken { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long dataTypeId; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nullable + private Long functionId; + + public static final String SERIALIZED_NAME_IMPORTED_FUNCTION_ID = "imported_function_id"; + @SerializedName(SERIALIZED_NAME_IMPORTED_FUNCTION_ID) + @javax.annotation.Nullable + private Long importedFunctionId; + + /** + * What the token names. + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + OWN_FUNCTION("own_function"), + + FUNCTION("function"), + + FUNCPTR("funcptr"), + + TYPE("type"), + + FIELD("field"), + + PARAM("param"), + + LOCAL("local"), + + GLOBAL("global"), + + ENUM("enum"), + + LABEL("label"), + + STRING("string"), + + FLOAT("float"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_VADDR = "vaddr"; + @SerializedName(SERIALIZED_NAME_VADDR) + @javax.annotation.Nullable + private Long vaddr; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nonnull + private String value; + + public RenderedToken() { + } + + public RenderedToken dataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Data type this token names, or for a field the type that declares it. Scoped by the response's analysis_id. + * @return dataTypeId + */ + @javax.annotation.Nullable + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public RenderedToken functionId(@javax.annotation.Nullable Long functionId) { + this.functionId = functionId; + return this; + } + + /** + * Function this token calls or names. Absent when the address reaches no function of this binary. + * @return functionId + */ + @javax.annotation.Nullable + public Long getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nullable Long functionId) { + this.functionId = functionId; + } + + + public RenderedToken importedFunctionId(@javax.annotation.Nullable Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + return this; + } + + /** + * Imported function this token calls. Set instead of function_id for an external call. + * @return importedFunctionId + */ + @javax.annotation.Nullable + public Long getImportedFunctionId() { + return importedFunctionId; + } + + public void setImportedFunctionId(@javax.annotation.Nullable Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + } + + + public RenderedToken kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * What the token names. + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public RenderedToken vaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + return this; + } + + /** + * Virtual address the token resolves to. Absent for a token with no address. + * @return vaddr + */ + @javax.annotation.Nullable + public Long getVaddr() { + return vaddr; + } + + public void setVaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + } + + + public RenderedToken value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Name the token resolves to. + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenderedToken renderedToken = (RenderedToken) o; + return Objects.equals(this.dataTypeId, renderedToken.dataTypeId) && + Objects.equals(this.functionId, renderedToken.functionId) && + Objects.equals(this.importedFunctionId, renderedToken.importedFunctionId) && + Objects.equals(this.kind, renderedToken.kind) && + Objects.equals(this.vaddr, renderedToken.vaddr) && + Objects.equals(this.value, renderedToken.value); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, functionId, importedFunctionId, kind, vaddr, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenderedToken {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" importedFunctionId: ").append(toIndentedString(importedFunctionId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" vaddr: ").append(toIndentedString(vaddr)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "function_id", "imported_function_id", "kind", "vaddr", "value")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("kind", "value")); + } + + /** + * 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 RenderedToken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RenderedToken.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 RenderedToken is not found in the empty JSON string", RenderedToken.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RenderedToken.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `RenderedToken` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RenderedToken.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RenderedToken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RenderedToken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RenderedToken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RenderedToken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RenderedToken read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RenderedToken given an JSON string + * + * @param jsonString JSON string + * @return An instance of RenderedToken + * @throws IOException if the JSON string is invalid with respect to RenderedToken + */ + public static RenderedToken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RenderedToken.class); + } + + /** + * Convert an instance of RenderedToken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/ResolvedEntity.java b/src/main/java/ai/reveng/model/ResolvedEntity.java new file mode 100644 index 00000000..0c407a0e --- /dev/null +++ b/src/main/java/ai/reveng/model/ResolvedEntity.java @@ -0,0 +1,1061 @@ +/* + * RevEng.AI API + * RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package ai.reveng.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import ai.reveng.invoker.JSON; + +/** + * ResolvedEntity + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class ResolvedEntity { + public static final String SERIALIZED_NAME_ADDR_TOKEN = "addr_token"; + @SerializedName(SERIALIZED_NAME_ADDR_TOKEN) + @javax.annotation.Nullable + private String addrToken; + + public static final String SERIALIZED_NAME_ALL_ADDR_TOKENS = "all_addr_tokens"; + @SerializedName(SERIALIZED_NAME_ALL_ADDR_TOKENS) + @javax.annotation.Nullable + private List allAddrTokens; + + public static final String SERIALIZED_NAME_BIT_OFFSET = "bit_offset"; + @SerializedName(SERIALIZED_NAME_BIT_OFFSET) + @javax.annotation.Nullable + private Long bitOffset; + + public static final String SERIALIZED_NAME_BYTE_OFFSET = "byte_offset"; + @SerializedName(SERIALIZED_NAME_BYTE_OFFSET) + @javax.annotation.Nullable + private Long byteOffset; + + public static final String SERIALIZED_NAME_BYTE_SIZE = "byte_size"; + @SerializedName(SERIALIZED_NAME_BYTE_SIZE) + @javax.annotation.Nullable + private Long byteSize; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nonnull + private Long count; + + public static final String SERIALIZED_NAME_DATA_TYPE_INDEX = "data_type_index"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_INDEX) + @javax.annotation.Nullable + private Long dataTypeIndex; + + /** + * Gets or Sets fieldStatus + */ + @JsonAdapter(FieldStatusEnum.Adapter.class) + public enum FieldStatusEnum { + BACKED("backed"), + + UNBACKED("unbacked"), + + UNMATCHED("unmatched"), + + AMBIGUOUS("ambiguous"), + + UNKEYED("unkeyed"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + FieldStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static FieldStatusEnum fromValue(String value) { + for (FieldStatusEnum b : FieldStatusEnum.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 FieldStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public FieldStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FieldStatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + FieldStatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_FIELD_STATUS = "field_status"; + @SerializedName(SERIALIZED_NAME_FIELD_STATUS) + @javax.annotation.Nullable + private FieldStatusEnum fieldStatus; + + public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; + @SerializedName(SERIALIZED_NAME_FUNCTION_ID) + @javax.annotation.Nullable + private Long functionId; + + public static final String SERIALIZED_NAME_IMPORTED_FUNCTION_ID = "imported_function_id"; + @SerializedName(SERIALIZED_NAME_IMPORTED_FUNCTION_ID) + @javax.annotation.Nullable + private Long importedFunctionId; + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nullable + private String kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + /** + * Gets or Sets nameSource + */ + @JsonAdapter(NameSourceEnum.Adapter.class) + public enum NameSourceEnum { + DATABASE("database"), + + FROZEN("frozen"), + + DEFAULT("default"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + NameSourceEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static NameSourceEnum fromValue(String value) { + for (NameSourceEnum b : NameSourceEnum.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 NameSourceEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public NameSourceEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NameSourceEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + NameSourceEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_NAME_SOURCE = "name_source"; + @SerializedName(SERIALIZED_NAME_NAME_SOURCE) + @javax.annotation.Nonnull + private NameSourceEnum nameSource; + + public static final String SERIALIZED_NAME_NEEDS_NAMING = "needs_naming"; + @SerializedName(SERIALIZED_NAME_NEEDS_NAMING) + @javax.annotation.Nonnull + private Boolean needsNaming; + + public static final String SERIALIZED_NAME_PROVENANCE = "provenance"; + @SerializedName(SERIALIZED_NAME_PROVENANCE) + @javax.annotation.Nullable + private String provenance; + + public static final String SERIALIZED_NAME_RESOLVED_NAME = "resolved_name"; + @SerializedName(SERIALIZED_NAME_RESOLVED_NAME) + @javax.annotation.Nullable + private String resolvedName; + + public static final String SERIALIZED_NAME_SUGGESTED_TYPE = "suggested_type"; + @SerializedName(SERIALIZED_NAME_SUGGESTED_TYPE) + @javax.annotation.Nullable + private String suggestedType; + + public static final String SERIALIZED_NAME_SUGGESTION_CONFIDENCE = "suggestion_confidence"; + @SerializedName(SERIALIZED_NAME_SUGGESTION_CONFIDENCE) + @javax.annotation.Nullable + private String suggestionConfidence; + + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + @javax.annotation.Nullable + private String token; + + public static final String SERIALIZED_NAME_TYPE_INDEX = "type_index"; + @SerializedName(SERIALIZED_NAME_TYPE_INDEX) + @javax.annotation.Nullable + private Long typeIndex; + + public static final String SERIALIZED_NAME_VADDR = "vaddr"; + @SerializedName(SERIALIZED_NAME_VADDR) + @javax.annotation.Nullable + private Long vaddr; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_VALUE_CONFIDENCE = "value_confidence"; + @SerializedName(SERIALIZED_NAME_VALUE_CONFIDENCE) + @javax.annotation.Nullable + private String valueConfidence; + + public static final String SERIALIZED_NAME_VALUE_TYPE = "value_type"; + @SerializedName(SERIALIZED_NAME_VALUE_TYPE) + @javax.annotation.Nullable + private String valueType; + + public ResolvedEntity() { + } + + public ResolvedEntity addrToken(@javax.annotation.Nullable String addrToken) { + this.addrToken = addrToken; + return this; + } + + /** + * Get addrToken + * @return addrToken + */ + @javax.annotation.Nullable + public String getAddrToken() { + return addrToken; + } + + public void setAddrToken(@javax.annotation.Nullable String addrToken) { + this.addrToken = addrToken; + } + + + public ResolvedEntity allAddrTokens(@javax.annotation.Nullable List allAddrTokens) { + this.allAddrTokens = allAddrTokens; + return this; + } + + public ResolvedEntity addAllAddrTokensItem(String allAddrTokensItem) { + if (this.allAddrTokens == null) { + this.allAddrTokens = new ArrayList<>(); + } + this.allAddrTokens.add(allAddrTokensItem); + return this; + } + + /** + * Get allAddrTokens + * @return allAddrTokens + */ + @javax.annotation.Nullable + public List getAllAddrTokens() { + return allAddrTokens; + } + + public void setAllAddrTokens(@javax.annotation.Nullable List allAddrTokens) { + this.allAddrTokens = allAddrTokens; + } + + + public ResolvedEntity bitOffset(@javax.annotation.Nullable Long bitOffset) { + this.bitOffset = bitOffset; + return this; + } + + /** + * Get bitOffset + * @return bitOffset + */ + @javax.annotation.Nullable + public Long getBitOffset() { + return bitOffset; + } + + public void setBitOffset(@javax.annotation.Nullable Long bitOffset) { + this.bitOffset = bitOffset; + } + + + public ResolvedEntity byteOffset(@javax.annotation.Nullable Long byteOffset) { + this.byteOffset = byteOffset; + return this; + } + + /** + * Get byteOffset + * @return byteOffset + */ + @javax.annotation.Nullable + public Long getByteOffset() { + return byteOffset; + } + + public void setByteOffset(@javax.annotation.Nullable Long byteOffset) { + this.byteOffset = byteOffset; + } + + + public ResolvedEntity byteSize(@javax.annotation.Nullable Long byteSize) { + this.byteSize = byteSize; + return this; + } + + /** + * Get byteSize + * @return byteSize + */ + @javax.annotation.Nullable + public Long getByteSize() { + return byteSize; + } + + public void setByteSize(@javax.annotation.Nullable Long byteSize) { + this.byteSize = byteSize; + } + + + public ResolvedEntity count(@javax.annotation.Nonnull Long count) { + this.count = count; + return this; + } + + /** + * Get count + * @return count + */ + @javax.annotation.Nonnull + public Long getCount() { + return count; + } + + public void setCount(@javax.annotation.Nonnull Long count) { + this.count = count; + } + + + public ResolvedEntity dataTypeIndex(@javax.annotation.Nullable Long dataTypeIndex) { + this.dataTypeIndex = dataTypeIndex; + return this; + } + + /** + * Get dataTypeIndex + * @return dataTypeIndex + */ + @javax.annotation.Nullable + public Long getDataTypeIndex() { + return dataTypeIndex; + } + + public void setDataTypeIndex(@javax.annotation.Nullable Long dataTypeIndex) { + this.dataTypeIndex = dataTypeIndex; + } + + + public ResolvedEntity fieldStatus(@javax.annotation.Nullable FieldStatusEnum fieldStatus) { + this.fieldStatus = fieldStatus; + return this; + } + + /** + * Get fieldStatus + * @return fieldStatus + */ + @javax.annotation.Nullable + public FieldStatusEnum getFieldStatus() { + return fieldStatus; + } + + public void setFieldStatus(@javax.annotation.Nullable FieldStatusEnum fieldStatus) { + this.fieldStatus = fieldStatus; + } + + + public ResolvedEntity functionId(@javax.annotation.Nullable Long functionId) { + this.functionId = functionId; + return this; + } + + /** + * Get functionId + * @return functionId + */ + @javax.annotation.Nullable + public Long getFunctionId() { + return functionId; + } + + public void setFunctionId(@javax.annotation.Nullable Long functionId) { + this.functionId = functionId; + } + + + public ResolvedEntity importedFunctionId(@javax.annotation.Nullable Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + return this; + } + + /** + * Get importedFunctionId + * @return importedFunctionId + */ + @javax.annotation.Nullable + public Long getImportedFunctionId() { + return importedFunctionId; + } + + public void setImportedFunctionId(@javax.annotation.Nullable Long importedFunctionId) { + this.importedFunctionId = importedFunctionId; + } + + + public ResolvedEntity kind(@javax.annotation.Nullable String kind) { + this.kind = kind; + return this; + } + + /** + * Search is applied to string value + * @return kind + */ + @javax.annotation.Nullable + public String getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nullable String kind) { + this.kind = kind; + } + + + public ResolvedEntity name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Search is applied to string value + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public ResolvedEntity nameSource(@javax.annotation.Nonnull NameSourceEnum nameSource) { + this.nameSource = nameSource; + return this; + } + + /** + * Get nameSource + * @return nameSource + */ + @javax.annotation.Nonnull + public NameSourceEnum getNameSource() { + return nameSource; + } + + public void setNameSource(@javax.annotation.Nonnull NameSourceEnum nameSource) { + this.nameSource = nameSource; + } + + + public ResolvedEntity needsNaming(@javax.annotation.Nonnull Boolean needsNaming) { + this.needsNaming = needsNaming; + return this; + } + + /** + * Get needsNaming + * @return needsNaming + */ + @javax.annotation.Nonnull + public Boolean getNeedsNaming() { + return needsNaming; + } + + public void setNeedsNaming(@javax.annotation.Nonnull Boolean needsNaming) { + this.needsNaming = needsNaming; + } + + + public ResolvedEntity provenance(@javax.annotation.Nullable String provenance) { + this.provenance = provenance; + return this; + } + + /** + * Search is applied to string value + * @return provenance + */ + @javax.annotation.Nullable + public String getProvenance() { + return provenance; + } + + public void setProvenance(@javax.annotation.Nullable String provenance) { + this.provenance = provenance; + } + + + public ResolvedEntity resolvedName(@javax.annotation.Nullable String resolvedName) { + this.resolvedName = resolvedName; + return this; + } + + /** + * Get resolvedName + * @return resolvedName + */ + @javax.annotation.Nullable + public String getResolvedName() { + return resolvedName; + } + + public void setResolvedName(@javax.annotation.Nullable String resolvedName) { + this.resolvedName = resolvedName; + } + + + public ResolvedEntity suggestedType(@javax.annotation.Nullable String suggestedType) { + this.suggestedType = suggestedType; + return this; + } + + /** + * Get suggestedType + * @return suggestedType + */ + @javax.annotation.Nullable + public String getSuggestedType() { + return suggestedType; + } + + public void setSuggestedType(@javax.annotation.Nullable String suggestedType) { + this.suggestedType = suggestedType; + } + + + public ResolvedEntity suggestionConfidence(@javax.annotation.Nullable String suggestionConfidence) { + this.suggestionConfidence = suggestionConfidence; + return this; + } + + /** + * Get suggestionConfidence + * @return suggestionConfidence + */ + @javax.annotation.Nullable + public String getSuggestionConfidence() { + return suggestionConfidence; + } + + public void setSuggestionConfidence(@javax.annotation.Nullable String suggestionConfidence) { + this.suggestionConfidence = suggestionConfidence; + } + + + public ResolvedEntity token(@javax.annotation.Nullable String token) { + this.token = token; + return this; + } + + /** + * Search is applied to string value + * @return token + */ + @javax.annotation.Nullable + public String getToken() { + return token; + } + + public void setToken(@javax.annotation.Nullable String token) { + this.token = token; + } + + + public ResolvedEntity typeIndex(@javax.annotation.Nullable Long typeIndex) { + this.typeIndex = typeIndex; + return this; + } + + /** + * Get typeIndex + * @return typeIndex + */ + @javax.annotation.Nullable + public Long getTypeIndex() { + return typeIndex; + } + + public void setTypeIndex(@javax.annotation.Nullable Long typeIndex) { + this.typeIndex = typeIndex; + } + + + public ResolvedEntity vaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + return this; + } + + /** + * Get vaddr + * @return vaddr + */ + @javax.annotation.Nullable + public Long getVaddr() { + return vaddr; + } + + public void setVaddr(@javax.annotation.Nullable Long vaddr) { + this.vaddr = vaddr; + } + + + public ResolvedEntity value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public ResolvedEntity valueConfidence(@javax.annotation.Nullable String valueConfidence) { + this.valueConfidence = valueConfidence; + return this; + } + + /** + * Get valueConfidence + * @return valueConfidence + */ + @javax.annotation.Nullable + public String getValueConfidence() { + return valueConfidence; + } + + public void setValueConfidence(@javax.annotation.Nullable String valueConfidence) { + this.valueConfidence = valueConfidence; + } + + + public ResolvedEntity valueType(@javax.annotation.Nullable String valueType) { + this.valueType = valueType; + return this; + } + + /** + * Get valueType + * @return valueType + */ + @javax.annotation.Nullable + public String getValueType() { + return valueType; + } + + public void setValueType(@javax.annotation.Nullable String valueType) { + this.valueType = valueType; + } + + /** + * 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 ResolvedEntity instance itself + */ + public ResolvedEntity 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; + } + ResolvedEntity resolvedEntity = (ResolvedEntity) o; + return Objects.equals(this.addrToken, resolvedEntity.addrToken) && + Objects.equals(this.allAddrTokens, resolvedEntity.allAddrTokens) && + Objects.equals(this.bitOffset, resolvedEntity.bitOffset) && + Objects.equals(this.byteOffset, resolvedEntity.byteOffset) && + Objects.equals(this.byteSize, resolvedEntity.byteSize) && + Objects.equals(this.count, resolvedEntity.count) && + Objects.equals(this.dataTypeIndex, resolvedEntity.dataTypeIndex) && + Objects.equals(this.fieldStatus, resolvedEntity.fieldStatus) && + Objects.equals(this.functionId, resolvedEntity.functionId) && + Objects.equals(this.importedFunctionId, resolvedEntity.importedFunctionId) && + Objects.equals(this.kind, resolvedEntity.kind) && + Objects.equals(this.name, resolvedEntity.name) && + Objects.equals(this.nameSource, resolvedEntity.nameSource) && + Objects.equals(this.needsNaming, resolvedEntity.needsNaming) && + Objects.equals(this.provenance, resolvedEntity.provenance) && + Objects.equals(this.resolvedName, resolvedEntity.resolvedName) && + Objects.equals(this.suggestedType, resolvedEntity.suggestedType) && + Objects.equals(this.suggestionConfidence, resolvedEntity.suggestionConfidence) && + Objects.equals(this.token, resolvedEntity.token) && + Objects.equals(this.typeIndex, resolvedEntity.typeIndex) && + Objects.equals(this.vaddr, resolvedEntity.vaddr) && + Objects.equals(this.value, resolvedEntity.value) && + Objects.equals(this.valueConfidence, resolvedEntity.valueConfidence) && + Objects.equals(this.valueType, resolvedEntity.valueType)&& + Objects.equals(this.additionalProperties, resolvedEntity.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(addrToken, allAddrTokens, bitOffset, byteOffset, byteSize, count, dataTypeIndex, fieldStatus, functionId, importedFunctionId, kind, name, nameSource, needsNaming, provenance, resolvedName, suggestedType, suggestionConfidence, token, typeIndex, vaddr, value, valueConfidence, valueType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResolvedEntity {\n"); + sb.append(" addrToken: ").append(toIndentedString(addrToken)).append("\n"); + sb.append(" allAddrTokens: ").append(toIndentedString(allAddrTokens)).append("\n"); + sb.append(" bitOffset: ").append(toIndentedString(bitOffset)).append("\n"); + sb.append(" byteOffset: ").append(toIndentedString(byteOffset)).append("\n"); + sb.append(" byteSize: ").append(toIndentedString(byteSize)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" dataTypeIndex: ").append(toIndentedString(dataTypeIndex)).append("\n"); + sb.append(" fieldStatus: ").append(toIndentedString(fieldStatus)).append("\n"); + sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append(" importedFunctionId: ").append(toIndentedString(importedFunctionId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" nameSource: ").append(toIndentedString(nameSource)).append("\n"); + sb.append(" needsNaming: ").append(toIndentedString(needsNaming)).append("\n"); + sb.append(" provenance: ").append(toIndentedString(provenance)).append("\n"); + sb.append(" resolvedName: ").append(toIndentedString(resolvedName)).append("\n"); + sb.append(" suggestedType: ").append(toIndentedString(suggestedType)).append("\n"); + sb.append(" suggestionConfidence: ").append(toIndentedString(suggestionConfidence)).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" typeIndex: ").append(toIndentedString(typeIndex)).append("\n"); + sb.append(" vaddr: ").append(toIndentedString(vaddr)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" valueConfidence: ").append(toIndentedString(valueConfidence)).append("\n"); + sb.append(" valueType: ").append(toIndentedString(valueType)).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("addr_token", "all_addr_tokens", "bit_offset", "byte_offset", "byte_size", "count", "data_type_index", "field_status", "function_id", "imported_function_id", "kind", "name", "name_source", "needs_naming", "provenance", "resolved_name", "suggested_type", "suggestion_confidence", "token", "type_index", "vaddr", "value", "value_confidence", "value_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("addr_token", "all_addr_tokens", "bit_offset", "byte_offset", "byte_size", "count", "data_type_index", "kind", "name", "name_source", "needs_naming", "provenance", "resolved_name", "suggested_type", "suggestion_confidence", "token", "type_index", "vaddr", "value", "value_confidence", "value_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResolvedEntity + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResolvedEntity.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 ResolvedEntity is not found in the empty JSON string", ResolvedEntity.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResolvedEntity.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("addr_token") != null && !jsonObj.get("addr_token").isJsonNull()) && !jsonObj.get("addr_token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `addr_token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("addr_token").toString())); + } + // ensure the required json array is present + if (jsonObj.get("all_addr_tokens") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("all_addr_tokens").isJsonArray() && !jsonObj.get("all_addr_tokens").isJsonNull()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `all_addr_tokens` to be an array in the JSON string but got `%s`", jsonObj.get("all_addr_tokens").toString())); + } + if ((jsonObj.get("field_status") != null && !jsonObj.get("field_status").isJsonNull()) && !jsonObj.get("field_status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `field_status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("field_status").toString())); + } + // validate the optional field `field_status` + if (jsonObj.get("field_status") != null && !jsonObj.get("field_status").isJsonNull()) { + FieldStatusEnum.validateJsonElement(jsonObj.get("field_status")); + } + if ((jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonNull()) && !jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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())); + } + if (!jsonObj.get("name_source").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name_source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_source").toString())); + } + // validate the required field `name_source` + NameSourceEnum.validateJsonElement(jsonObj.get("name_source")); + if ((jsonObj.get("provenance") != null && !jsonObj.get("provenance").isJsonNull()) && !jsonObj.get("provenance").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `provenance` to be a primitive type in the JSON string but got `%s`", jsonObj.get("provenance").toString())); + } + if ((jsonObj.get("resolved_name") != null && !jsonObj.get("resolved_name").isJsonNull()) && !jsonObj.get("resolved_name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `resolved_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("resolved_name").toString())); + } + if ((jsonObj.get("suggested_type") != null && !jsonObj.get("suggested_type").isJsonNull()) && !jsonObj.get("suggested_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `suggested_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suggested_type").toString())); + } + if ((jsonObj.get("suggestion_confidence") != null && !jsonObj.get("suggestion_confidence").isJsonNull()) && !jsonObj.get("suggestion_confidence").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `suggestion_confidence` to be a primitive type in the JSON string but got `%s`", jsonObj.get("suggestion_confidence").toString())); + } + if ((jsonObj.get("token") != null && !jsonObj.get("token").isJsonNull()) && !jsonObj.get("token").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `token` to be a primitive type in the JSON string but got `%s`", jsonObj.get("token").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("value_confidence") != null && !jsonObj.get("value_confidence").isJsonNull()) && !jsonObj.get("value_confidence").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value_confidence` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value_confidence").toString())); + } + if ((jsonObj.get("value_type") != null && !jsonObj.get("value_type").isJsonNull()) && !jsonObj.get("value_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value_type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResolvedEntity.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResolvedEntity' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResolvedEntity.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResolvedEntity 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 ResolvedEntity read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ResolvedEntity 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 ResolvedEntity given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResolvedEntity + * @throws IOException if the JSON string is invalid with respect to ResolvedEntity + */ + public static ResolvedEntity fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResolvedEntity.class); + } + + /** + * Convert an instance of ResolvedEntity to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SegmentInfo.java b/src/main/java/ai/reveng/model/SegmentInfo.java index b6e66ee8..1b84f2f1 100644 --- a/src/main/java/ai/reveng/model/SegmentInfo.java +++ b/src/main/java/ai/reveng/model/SegmentInfo.java @@ -46,7 +46,7 @@ import ai.reveng.invoker.JSON; /** - * Represents the information about a segment. Attributes: name: The name of the segment. r: Determines if the segment has read permission. w: Determines if the segment has write permission. x: Determines if the segment has execute permission. start: The start address of the segment. end: The end address of the segment. + * Represents the information about a segment. Attributes: name: The name of the segment. r: Determines if the segment has read permission. w: Determines if the segment has write permission. x: Determines if the segment has execute permission. start: The start address of the segment. end: The end address of the segment (inclusive). kind: Coarse classification of the segment: \"code\", \"data\", or \"other\". */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class SegmentInfo { @@ -80,6 +80,11 @@ public class SegmentInfo { @javax.annotation.Nullable private Integer end = 0; + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nullable + private String kind = "other"; + public SegmentInfo() { } @@ -196,6 +201,25 @@ public void setEnd(@javax.annotation.Nullable Integer end) { this.end = end; } + + public SegmentInfo kind(@javax.annotation.Nullable String kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nullable + public String getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nullable String kind) { + this.kind = kind; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -256,7 +280,8 @@ public boolean equals(Object o) { Objects.equals(this.w, segmentInfo.w) && Objects.equals(this.x, segmentInfo.x) && Objects.equals(this.start, segmentInfo.start) && - Objects.equals(this.end, segmentInfo.end)&& + Objects.equals(this.end, segmentInfo.end) && + Objects.equals(this.kind, segmentInfo.kind)&& Objects.equals(this.additionalProperties, segmentInfo.additionalProperties); } @@ -266,7 +291,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(name, r, w, x, start, end, additionalProperties); + return Objects.hash(name, r, w, x, start, end, kind, additionalProperties); } private static int hashCodeNullable(JsonNullable a) { @@ -286,6 +311,7 @@ public String toString() { sb.append(" x: ").append(toIndentedString(x)).append("\n"); sb.append(" start: ").append(toIndentedString(start)).append("\n"); sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -305,7 +331,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("name", "r", "w", "x", "start", "end")); + openapiFields = new HashSet(Arrays.asList("name", "r", "w", "x", "start", "end", "kind")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); @@ -327,6 +353,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !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())); } + if ((jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonNull()) && !jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/ai/reveng/model/SignatureParameterEntry.java b/src/main/java/ai/reveng/model/SignatureParameterEntry.java new file mode 100644 index 00000000..8d666de2 --- /dev/null +++ b/src/main/java/ai/reveng/model/SignatureParameterEntry.java @@ -0,0 +1,317 @@ +/* + * 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.SignatureStorageEntry; +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; + +/** + * SignatureParameterEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SignatureParameterEntry { + public static final String SERIALIZED_NAME_BIT_LENGTH = "bit_length"; + @SerializedName(SERIALIZED_NAME_BIT_LENGTH) + @javax.annotation.Nullable + private Long bitLength; + + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long dataTypeId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ORDINAL = "ordinal"; + @SerializedName(SERIALIZED_NAME_ORDINAL) + @javax.annotation.Nonnull + private Long ordinal; + + public static final String SERIALIZED_NAME_STORAGE = "storage"; + @SerializedName(SERIALIZED_NAME_STORAGE) + @javax.annotation.Nullable + private SignatureStorageEntry storage; + + public SignatureParameterEntry() { + } + + public SignatureParameterEntry bitLength(@javax.annotation.Nullable Long bitLength) { + this.bitLength = bitLength; + return this; + } + + /** + * Width in bits, when the parameter occupies less than its type's full size. + * @return bitLength + */ + @javax.annotation.Nullable + public Long getBitLength() { + return bitLength; + } + + public void setBitLength(@javax.annotation.Nullable Long bitLength) { + this.bitLength = bitLength; + } + + + public SignatureParameterEntry dataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The parameter's type, resolvable against the analysis data types list. Absent when the type could not be resolved. + * @return dataTypeId + */ + @javax.annotation.Nullable + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public SignatureParameterEntry name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Parameter name, absent when the producer had none. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SignatureParameterEntry ordinal(@javax.annotation.Nonnull Long ordinal) { + this.ordinal = ordinal; + return this; + } + + /** + * Zero-based argument position. + * @return ordinal + */ + @javax.annotation.Nonnull + public Long getOrdinal() { + return ordinal; + } + + public void setOrdinal(@javax.annotation.Nonnull Long ordinal) { + this.ordinal = ordinal; + } + + + public SignatureParameterEntry storage(@javax.annotation.Nullable SignatureStorageEntry storage) { + this.storage = storage; + return this; + } + + /** + * Where the parameter is passed. + * @return storage + */ + @javax.annotation.Nullable + public SignatureStorageEntry getStorage() { + return storage; + } + + public void setStorage(@javax.annotation.Nullable SignatureStorageEntry storage) { + this.storage = storage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SignatureParameterEntry signatureParameterEntry = (SignatureParameterEntry) o; + return Objects.equals(this.bitLength, signatureParameterEntry.bitLength) && + Objects.equals(this.dataTypeId, signatureParameterEntry.dataTypeId) && + Objects.equals(this.name, signatureParameterEntry.name) && + Objects.equals(this.ordinal, signatureParameterEntry.ordinal) && + Objects.equals(this.storage, signatureParameterEntry.storage); + } + + @Override + public int hashCode() { + return Objects.hash(bitLength, dataTypeId, name, ordinal, storage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SignatureParameterEntry {\n"); + sb.append(" bitLength: ").append(toIndentedString(bitLength)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ordinal: ").append(toIndentedString(ordinal)).append("\n"); + sb.append(" storage: ").append(toIndentedString(storage)).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("bit_length", "data_type_id", "name", "ordinal", "storage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("ordinal")); + } + + /** + * 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 SignatureParameterEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SignatureParameterEntry.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 SignatureParameterEntry is not found in the empty JSON string", SignatureParameterEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SignatureParameterEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `SignatureParameterEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SignatureParameterEntry.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") != null && !jsonObj.get("name").isJsonNull()) && !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())); + } + // validate the optional field `storage` + if (jsonObj.get("storage") != null && !jsonObj.get("storage").isJsonNull()) { + SignatureStorageEntry.validateJsonElement(jsonObj.get("storage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SignatureParameterEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SignatureParameterEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SignatureParameterEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SignatureParameterEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SignatureParameterEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SignatureParameterEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of SignatureParameterEntry + * @throws IOException if the JSON string is invalid with respect to SignatureParameterEntry + */ + public static SignatureParameterEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SignatureParameterEntry.class); + } + + /** + * Convert an instance of SignatureParameterEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SignatureParameterInput.java b/src/main/java/ai/reveng/model/SignatureParameterInput.java new file mode 100644 index 00000000..538f5293 --- /dev/null +++ b/src/main/java/ai/reveng/model/SignatureParameterInput.java @@ -0,0 +1,320 @@ +/* + * 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.SignatureStorageInput; +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; + +/** + * SignatureParameterInput + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SignatureParameterInput { + public static final String SERIALIZED_NAME_BIT_LENGTH = "bit_length"; + @SerializedName(SERIALIZED_NAME_BIT_LENGTH) + @javax.annotation.Nullable + private Long bitLength; + + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long dataTypeId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nullable + private String name; + + public static final String SERIALIZED_NAME_ORDINAL = "ordinal"; + @SerializedName(SERIALIZED_NAME_ORDINAL) + @javax.annotation.Nonnull + private Long ordinal; + + public static final String SERIALIZED_NAME_STORAGE = "storage"; + @SerializedName(SERIALIZED_NAME_STORAGE) + @javax.annotation.Nullable + private SignatureStorageInput storage; + + public SignatureParameterInput() { + } + + public SignatureParameterInput bitLength(@javax.annotation.Nullable Long bitLength) { + this.bitLength = bitLength; + return this; + } + + /** + * Width in bits, when the parameter occupies less than its type's full size. + * minimum: 0 + * @return bitLength + */ + @javax.annotation.Nullable + public Long getBitLength() { + return bitLength; + } + + public void setBitLength(@javax.annotation.Nullable Long bitLength) { + this.bitLength = bitLength; + } + + + public SignatureParameterInput dataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The parameter's type, which must belong to this analysis. Omit for an unresolved type. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nullable + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nullable Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public SignatureParameterInput name(@javax.annotation.Nullable String name) { + this.name = name; + return this; + } + + /** + * Parameter name. Omit for an unnamed parameter. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nullable String name) { + this.name = name; + } + + + public SignatureParameterInput ordinal(@javax.annotation.Nonnull Long ordinal) { + this.ordinal = ordinal; + return this; + } + + /** + * Zero-based argument position. Must equal the parameter's index in the list. + * minimum: 0 + * @return ordinal + */ + @javax.annotation.Nonnull + public Long getOrdinal() { + return ordinal; + } + + public void setOrdinal(@javax.annotation.Nonnull Long ordinal) { + this.ordinal = ordinal; + } + + + public SignatureParameterInput storage(@javax.annotation.Nullable SignatureStorageInput storage) { + this.storage = storage; + return this; + } + + /** + * Where the parameter is passed. + * @return storage + */ + @javax.annotation.Nullable + public SignatureStorageInput getStorage() { + return storage; + } + + public void setStorage(@javax.annotation.Nullable SignatureStorageInput storage) { + this.storage = storage; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SignatureParameterInput signatureParameterInput = (SignatureParameterInput) o; + return Objects.equals(this.bitLength, signatureParameterInput.bitLength) && + Objects.equals(this.dataTypeId, signatureParameterInput.dataTypeId) && + Objects.equals(this.name, signatureParameterInput.name) && + Objects.equals(this.ordinal, signatureParameterInput.ordinal) && + Objects.equals(this.storage, signatureParameterInput.storage); + } + + @Override + public int hashCode() { + return Objects.hash(bitLength, dataTypeId, name, ordinal, storage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SignatureParameterInput {\n"); + sb.append(" bitLength: ").append(toIndentedString(bitLength)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ordinal: ").append(toIndentedString(ordinal)).append("\n"); + sb.append(" storage: ").append(toIndentedString(storage)).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("bit_length", "data_type_id", "name", "ordinal", "storage")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("ordinal")); + } + + /** + * 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 SignatureParameterInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SignatureParameterInput.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 SignatureParameterInput is not found in the empty JSON string", SignatureParameterInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SignatureParameterInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `SignatureParameterInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SignatureParameterInput.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") != null && !jsonObj.get("name").isJsonNull()) && !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())); + } + // validate the optional field `storage` + if (jsonObj.get("storage") != null && !jsonObj.get("storage").isJsonNull()) { + SignatureStorageInput.validateJsonElement(jsonObj.get("storage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SignatureParameterInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SignatureParameterInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SignatureParameterInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SignatureParameterInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SignatureParameterInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SignatureParameterInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of SignatureParameterInput + * @throws IOException if the JSON string is invalid with respect to SignatureParameterInput + */ + public static SignatureParameterInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SignatureParameterInput.class); + } + + /** + * Convert an instance of SignatureParameterInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SignatureStorageEntry.java b/src/main/java/ai/reveng/model/SignatureStorageEntry.java new file mode 100644 index 00000000..07d28d07 --- /dev/null +++ b/src/main/java/ai/reveng/model/SignatureStorageEntry.java @@ -0,0 +1,230 @@ +/* + * 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; + +/** + * SignatureStorageEntry + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SignatureStorageEntry { + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nullable + private String kind; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private String location; + + public SignatureStorageEntry() { + } + + public SignatureStorageEntry kind(@javax.annotation.Nullable String kind) { + this.kind = kind; + return this; + } + + /** + * Storage class — typically reg, stack, mem or unknown. Not restricted to a fixed set. + * @return kind + */ + @javax.annotation.Nullable + public String getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nullable String kind) { + this.kind = kind; + } + + + public SignatureStorageEntry location(@javax.annotation.Nullable String location) { + this.location = location; + return this; + } + + /** + * Register name or stack slot. + * @return location + */ + @javax.annotation.Nullable + public String getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable String location) { + this.location = location; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SignatureStorageEntry signatureStorageEntry = (SignatureStorageEntry) o; + return Objects.equals(this.kind, signatureStorageEntry.kind) && + Objects.equals(this.location, signatureStorageEntry.location); + } + + @Override + public int hashCode() { + return Objects.hash(kind, location); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SignatureStorageEntry {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).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("kind", "location")); + + // 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 SignatureStorageEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SignatureStorageEntry.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 SignatureStorageEntry is not found in the empty JSON string", SignatureStorageEntry.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SignatureStorageEntry.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `SignatureStorageEntry` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonNull()) && !jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + if ((jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) && !jsonObj.get("location").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `location` to be a primitive type in the JSON string but got `%s`", jsonObj.get("location").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SignatureStorageEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SignatureStorageEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SignatureStorageEntry.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SignatureStorageEntry value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SignatureStorageEntry read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SignatureStorageEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of SignatureStorageEntry + * @throws IOException if the JSON string is invalid with respect to SignatureStorageEntry + */ + public static SignatureStorageEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SignatureStorageEntry.class); + } + + /** + * Convert an instance of SignatureStorageEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/SignatureStorageInput.java b/src/main/java/ai/reveng/model/SignatureStorageInput.java new file mode 100644 index 00000000..57716971 --- /dev/null +++ b/src/main/java/ai/reveng/model/SignatureStorageInput.java @@ -0,0 +1,230 @@ +/* + * 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; + +/** + * SignatureStorageInput + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class SignatureStorageInput { + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nullable + private String kind; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private String location; + + public SignatureStorageInput() { + } + + public SignatureStorageInput kind(@javax.annotation.Nullable String kind) { + this.kind = kind; + return this; + } + + /** + * Storage class — typically reg, stack, mem or unknown. Not restricted to a fixed set. + * @return kind + */ + @javax.annotation.Nullable + public String getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nullable String kind) { + this.kind = kind; + } + + + public SignatureStorageInput location(@javax.annotation.Nullable String location) { + this.location = location; + return this; + } + + /** + * Register name or stack slot. + * @return location + */ + @javax.annotation.Nullable + public String getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable String location) { + this.location = location; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SignatureStorageInput signatureStorageInput = (SignatureStorageInput) o; + return Objects.equals(this.kind, signatureStorageInput.kind) && + Objects.equals(this.location, signatureStorageInput.location); + } + + @Override + public int hashCode() { + return Objects.hash(kind, location); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SignatureStorageInput {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).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("kind", "location")); + + // 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 SignatureStorageInput + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SignatureStorageInput.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 SignatureStorageInput is not found in the empty JSON string", SignatureStorageInput.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SignatureStorageInput.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `SignatureStorageInput` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("kind") != null && !jsonObj.get("kind").isJsonNull()) && !jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + if ((jsonObj.get("location") != null && !jsonObj.get("location").isJsonNull()) && !jsonObj.get("location").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `location` to be a primitive type in the JSON string but got `%s`", jsonObj.get("location").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SignatureStorageInput.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SignatureStorageInput' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SignatureStorageInput.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SignatureStorageInput value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SignatureStorageInput read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SignatureStorageInput given an JSON string + * + * @param jsonString JSON string + * @return An instance of SignatureStorageInput + * @throws IOException if the JSON string is invalid with respect to SignatureStorageInput + */ + public static SignatureStorageInput fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SignatureStorageInput.class); + } + + /** + * Convert an instance of SignatureStorageInput to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/BatchUpdateDataTypesResult.java b/src/main/java/ai/reveng/model/StatusBody.java similarity index 57% rename from src/main/java/ai/reveng/model/BatchUpdateDataTypesResult.java rename to src/main/java/ai/reveng/model/StatusBody.java index 66bafadd..409c5bcc 100644 --- a/src/main/java/ai/reveng/model/BatchUpdateDataTypesResult.java +++ b/src/main/java/ai/reveng/model/StatusBody.java @@ -19,7 +19,9 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; @@ -46,40 +48,34 @@ import ai.reveng.invoker.JSON; /** - * BatchUpdateDataTypesResult + * StatusBody */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class BatchUpdateDataTypesResult { - public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES) - @javax.annotation.Nullable - private Object dataTypes = null; - - public static final String SERIALIZED_NAME_DATA_TYPES_VERSION = "data_types_version"; - @SerializedName(SERIALIZED_NAME_DATA_TYPES_VERSION) +public class StatusBody { + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "error_message"; + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) @javax.annotation.Nullable - private Long dataTypesVersion; + private String errorMessage; - public static final String SERIALIZED_NAME_ERROR = "error"; - @SerializedName(SERIALIZED_NAME_ERROR) + public static final String SERIALIZED_NAME_LOG_HISTORY = "log_history"; + @SerializedName(SERIALIZED_NAME_LOG_HISTORY) @javax.annotation.Nullable - private String error; - - public static final String SERIALIZED_NAME_FUNCTION_ID = "function_id"; - @SerializedName(SERIALIZED_NAME_FUNCTION_ID) - @javax.annotation.Nonnull - private Long functionId; + private List> logHistory; /** - * Outcome for this function + * Run status. UNINITIALISED means the agent has never been triggered for this analysis. */ @JsonAdapter(StatusEnum.Adapter.class) public enum StatusEnum { - UPDATED("updated"), + UNINITIALISED("UNINITIALISED"), + + PENDING("PENDING"), + + RUNNING("RUNNING"), - VERSION_CONFLICT("version_conflict"), + COMPLETED("COMPLETED"), - ERROR("error"), + FAILED("FAILED"), UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); @@ -131,92 +127,62 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti @javax.annotation.Nonnull private StatusEnum status; - public BatchUpdateDataTypesResult() { + public StatusBody() { } - public BatchUpdateDataTypesResult dataTypes(@javax.annotation.Nullable Object dataTypes) { - this.dataTypes = dataTypes; + public StatusBody errorMessage(@javax.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; return this; } /** - * Get dataTypes - * @return dataTypes + * Why the run failed. Only set when status is FAILED. + * @return errorMessage */ @javax.annotation.Nullable - public Object getDataTypes() { - return dataTypes; + public String getErrorMessage() { + return errorMessage; } - public void setDataTypes(@javax.annotation.Nullable Object dataTypes) { - this.dataTypes = dataTypes; + public void setErrorMessage(@javax.annotation.Nullable String errorMessage) { + this.errorMessage = errorMessage; } - public BatchUpdateDataTypesResult dataTypesVersion(@javax.annotation.Nullable Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; + public StatusBody logHistory(@javax.annotation.Nullable List> logHistory) { + this.logHistory = logHistory; return this; } - /** - * Version after update (present when status is 'updated') - * @return dataTypesVersion - */ - @javax.annotation.Nullable - public Long getDataTypesVersion() { - return dataTypesVersion; - } - - public void setDataTypesVersion(@javax.annotation.Nullable Long dataTypesVersion) { - this.dataTypesVersion = dataTypesVersion; - } - - - public BatchUpdateDataTypesResult error(@javax.annotation.Nullable String error) { - this.error = error; + public StatusBody addLogHistoryItem(List logHistoryItem) { + if (this.logHistory == null) { + this.logHistory = new ArrayList<>(); + } + this.logHistory.add(logHistoryItem); return this; } /** - * Error message (present when status is 'error') - * @return error + * Progress messages the run recorded, oldest first. + * @return logHistory */ @javax.annotation.Nullable - public String getError() { - return error; - } - - public void setError(@javax.annotation.Nullable String error) { - this.error = error; - } - - - public BatchUpdateDataTypesResult functionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; - return this; + public List> getLogHistory() { + return logHistory; } - /** - * Function ID - * @return functionId - */ - @javax.annotation.Nonnull - public Long getFunctionId() { - return functionId; - } - - public void setFunctionId(@javax.annotation.Nonnull Long functionId) { - this.functionId = functionId; + public void setLogHistory(@javax.annotation.Nullable List> logHistory) { + this.logHistory = logHistory; } - public BatchUpdateDataTypesResult status(@javax.annotation.Nonnull StatusEnum status) { + public StatusBody status(@javax.annotation.Nonnull StatusEnum status) { this.status = status; return this; } /** - * Outcome for this function + * Run status. UNINITIALISED means the agent has never been triggered for this analysis. * @return status */ @javax.annotation.Nonnull @@ -238,12 +204,10 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BatchUpdateDataTypesResult batchUpdateDataTypesResult = (BatchUpdateDataTypesResult) o; - return Objects.equals(this.dataTypes, batchUpdateDataTypesResult.dataTypes) && - Objects.equals(this.dataTypesVersion, batchUpdateDataTypesResult.dataTypesVersion) && - Objects.equals(this.error, batchUpdateDataTypesResult.error) && - Objects.equals(this.functionId, batchUpdateDataTypesResult.functionId) && - Objects.equals(this.status, batchUpdateDataTypesResult.status); + StatusBody statusBody = (StatusBody) o; + return Objects.equals(this.errorMessage, statusBody.errorMessage) && + Objects.equals(this.logHistory, statusBody.logHistory) && + Objects.equals(this.status, statusBody.status); } private static boolean equalsNullable(JsonNullable a, JsonNullable b) { @@ -252,7 +216,7 @@ private static boolean equalsNullable(JsonNullable a, JsonNullable b) @Override public int hashCode() { - return Objects.hash(dataTypes, dataTypesVersion, error, functionId, status); + return Objects.hash(errorMessage, logHistory, status); } private static int hashCodeNullable(JsonNullable a) { @@ -265,11 +229,9 @@ private static int hashCodeNullable(JsonNullable a) { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BatchUpdateDataTypesResult {\n"); - sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); - sb.append(" dataTypesVersion: ").append(toIndentedString(dataTypesVersion)).append("\n"); - sb.append(" error: ").append(toIndentedString(error)).append("\n"); - sb.append(" functionId: ").append(toIndentedString(functionId)).append("\n"); + sb.append("class StatusBody {\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" logHistory: ").append(toIndentedString(logHistory)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); return sb.toString(); @@ -289,42 +251,46 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("data_types", "data_types_version", "error", "function_id", "status")); + openapiFields = new HashSet(Arrays.asList("error_message", "log_history", "status")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("function_id", "status")); + 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 BatchUpdateDataTypesResult + * @throws IOException if the JSON Element is invalid with respect to StatusBody */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!BatchUpdateDataTypesResult.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 BatchUpdateDataTypesResult is not found in the empty JSON string", BatchUpdateDataTypesResult.openapiRequiredFields.toString())); + if (!StatusBody.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 StatusBody is not found in the empty JSON string", StatusBody.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!BatchUpdateDataTypesResult.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `BatchUpdateDataTypesResult` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!StatusBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `StatusBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : BatchUpdateDataTypesResult.openapiRequiredFields) { + for (String requiredField : StatusBody.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("error") != null && !jsonObj.get("error").isJsonNull()) && !jsonObj.get("error").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + if ((jsonObj.get("error_message") != null && !jsonObj.get("error_message").isJsonNull()) && !jsonObj.get("error_message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `error_message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error_message").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("log_history") != null && !jsonObj.get("log_history").isJsonNull() && !jsonObj.get("log_history").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `log_history` to be an array in the JSON string but got `%s`", jsonObj.get("log_history").toString())); } 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())); @@ -337,22 +303,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!BatchUpdateDataTypesResult.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'BatchUpdateDataTypesResult' and its subtypes + if (!StatusBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatusBody' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(BatchUpdateDataTypesResult.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatusBody.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, BatchUpdateDataTypesResult value) throws IOException { + public void write(JsonWriter out, StatusBody value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public BatchUpdateDataTypesResult read(JsonReader in) throws IOException { + public StatusBody read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -363,18 +329,18 @@ public BatchUpdateDataTypesResult read(JsonReader in) throws IOException { } /** - * Create an instance of BatchUpdateDataTypesResult given an JSON string + * Create an instance of StatusBody given an JSON string * * @param jsonString JSON string - * @return An instance of BatchUpdateDataTypesResult - * @throws IOException if the JSON string is invalid with respect to BatchUpdateDataTypesResult + * @return An instance of StatusBody + * @throws IOException if the JSON string is invalid with respect to StatusBody */ - public static BatchUpdateDataTypesResult fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, BatchUpdateDataTypesResult.class); + public static StatusBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatusBody.class); } /** - * Convert an instance of BatchUpdateDataTypesResult to an JSON string + * Convert an instance of StatusBody to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/StructDataType.java b/src/main/java/ai/reveng/model/StructDataType.java new file mode 100644 index 00000000..65c9df92 --- /dev/null +++ b/src/main/java/ai/reveng/model/StructDataType.java @@ -0,0 +1,652 @@ +/* + * 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.StructDefinition; +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; + +/** + * StructDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StructDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private StructDefinition definition; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + STRUCT("STRUCT"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public StructDataType() { + } + + public StructDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public StructDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public StructDataType definition(@javax.annotation.Nullable StructDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Absent only for a type referenced but never defined. + * @return definition + */ + @javax.annotation.Nullable + public StructDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable StructDefinition definition) { + this.definition = definition; + } + + + public StructDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public StructDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public StructDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public StructDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public StructDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public StructDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public StructDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + /** + * 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 StructDataType instance itself + */ + public StructDataType 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; + } + StructDataType structDataType = (StructDataType) o; + return Objects.equals(this.createdAt, structDataType.createdAt) && + Objects.equals(this.dataTypeId, structDataType.dataTypeId) && + Objects.equals(this.definition, structDataType.definition) && + Objects.equals(this.hasDefinition, structDataType.hasDefinition) && + Objects.equals(this.kind, structDataType.kind) && + Objects.equals(this.name, structDataType.name) && + Objects.equals(this.namespace, structDataType.namespace) && + Objects.equals(this.size, structDataType.size) && + Objects.equals(this.sourceFunctionId, structDataType.sourceFunctionId) && + Objects.equals(this.sourceType, structDataType.sourceType)&& + Objects.equals(this.additionalProperties, structDataType.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, definition, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StructDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "definition", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StructDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StructDataType.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 StructDataType is not found in the empty JSON string", StructDataType.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StructDataType.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(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + StructDefinition.validateJsonElement(jsonObj.get("definition")); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StructDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StructDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StructDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StructDataType 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 StructDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + StructDataType 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 StructDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of StructDataType + * @throws IOException if the JSON string is invalid with respect to StructDataType + */ + public static StructDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StructDataType.class); + } + + /** + * Convert an instance of StructDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/StructDefinition.java b/src/main/java/ai/reveng/model/StructDefinition.java new file mode 100644 index 00000000..c24e9c91 --- /dev/null +++ b/src/main/java/ai/reveng/model/StructDefinition.java @@ -0,0 +1,226 @@ +/* + * 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.DataTypeMemberEntry; +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; + +/** + * StructDefinition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class StructDefinition { + public static final String SERIALIZED_NAME_MEMBERS = "members"; + @SerializedName(SERIALIZED_NAME_MEMBERS) + @javax.annotation.Nullable + private List members; + + public StructDefinition() { + } + + public StructDefinition members(@javax.annotation.Nullable List members) { + this.members = members; + return this; + } + + public StructDefinition addMembersItem(DataTypeMemberEntry membersItem) { + if (this.members == null) { + this.members = new ArrayList<>(); + } + this.members.add(membersItem); + return this; + } + + /** + * The type's fields, in offset order. + * @return members + */ + @javax.annotation.Nullable + public List getMembers() { + return members; + } + + public void setMembers(@javax.annotation.Nullable List members) { + this.members = members; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StructDefinition structDefinition = (StructDefinition) o; + return Objects.equals(this.members, structDefinition.members); + } + + @Override + public int hashCode() { + return Objects.hash(members); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StructDefinition {\n"); + sb.append(" members: ").append(toIndentedString(members)).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("members")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("members")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StructDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StructDefinition.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 StructDefinition is not found in the empty JSON string", StructDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StructDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `StructDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StructDefinition.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("members") != null && !jsonObj.get("members").isJsonNull()) { + if (!jsonObj.get("members").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `members` to be an array in the JSON string but got `%s`", jsonObj.get("members").toString())); + } + JsonArray jsonArraymembers = jsonObj.getAsJsonArray("members"); + // validate the required field `members` (array) + for (int i = 0; i < jsonArraymembers.size(); i++) { + DataTypeMemberEntry.validateJsonElement(jsonArraymembers.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StructDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StructDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StructDefinition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StructDefinition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StructDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StructDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of StructDefinition + * @throws IOException if the JSON string is invalid with respect to StructDefinition + */ + public static StructDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StructDefinition.class); + } + + /** + * Convert an instance of StructDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/Structure.java b/src/main/java/ai/reveng/model/Structure.java deleted file mode 100644 index b7790a7d..00000000 --- a/src/main/java/ai/reveng/model/Structure.java +++ /dev/null @@ -1,422 +0,0 @@ -/* - * 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.StructureMember; -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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * Structure - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class Structure { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_SIZE = "size"; - @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nullable - private Integer size; - - public static final String SERIALIZED_NAME_MEMBERS = "members"; - @SerializedName(SERIALIZED_NAME_MEMBERS) - @javax.annotation.Nonnull - private Map members = new HashMap<>(); - - public static final String SERIALIZED_NAME_ARTIFACT_TYPE = "artifact_type"; - @SerializedName(SERIALIZED_NAME_ARTIFACT_TYPE) - @javax.annotation.Nullable - private String artifactType; - - public Structure() { - } - - public Structure lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this structure - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public Structure name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the structure - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public Structure size(@javax.annotation.Nullable Integer size) { - this.size = size; - return this; - } - - /** - * Total size of the structure in bytes - * @return size - */ - @javax.annotation.Nullable - public Integer getSize() { - return size; - } - - public void setSize(@javax.annotation.Nullable Integer size) { - this.size = size; - } - - - public Structure members(@javax.annotation.Nonnull Map members) { - this.members = members; - return this; - } - - public Structure putMembersItem(String key, StructureMember membersItem) { - if (this.members == null) { - this.members = new HashMap<>(); - } - this.members.put(key, membersItem); - return this; - } - - /** - * Dictionary of structure members - * @return members - */ - @javax.annotation.Nonnull - public Map getMembers() { - return members; - } - - public void setMembers(@javax.annotation.Nonnull Map members) { - this.members = members; - } - - - public Structure artifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - return this; - } - - /** - * Type of artifact that the structure is associated with - * @return artifactType - */ - @javax.annotation.Nullable - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - } - - /** - * 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 Structure instance itself - */ - public Structure 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; - } - Structure structure = (Structure) o; - return Objects.equals(this.lastChange, structure.lastChange) && - Objects.equals(this.name, structure.name) && - Objects.equals(this.size, structure.size) && - Objects.equals(this.members, structure.members) && - Objects.equals(this.artifactType, structure.artifactType)&& - Objects.equals(this.additionalProperties, structure.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, name, size, members, artifactType, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Structure {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" members: ").append(toIndentedString(members)).append("\n"); - sb.append(" artifactType: ").append(toIndentedString(artifactType)).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("last_change", "name", "size", "members", "artifact_type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "members")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Structure - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Structure.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 Structure is not found in the empty JSON string", Structure.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Structure.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if ((jsonObj.get("artifact_type") != null && !jsonObj.get("artifact_type").isJsonNull()) && !jsonObj.get("artifact_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `artifact_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("artifact_type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Structure.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Structure' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Structure.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Structure 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 Structure read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Structure 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 Structure given an JSON string - * - * @param jsonString JSON string - * @return An instance of Structure - * @throws IOException if the JSON string is invalid with respect to Structure - */ - public static Structure fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Structure.class); - } - - /** - * Convert an instance of Structure to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/StructureMember.java b/src/main/java/ai/reveng/model/StructureMember.java deleted file mode 100644 index 7ac675d3..00000000 --- a/src/main/java/ai/reveng/model/StructureMember.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * 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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * StructureMember - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class StructureMember { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_OFFSET = "offset"; - @SerializedName(SERIALIZED_NAME_OFFSET) - @javax.annotation.Nonnull - private Integer offset; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_SIZE = "size"; - @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nonnull - private Integer size; - - public StructureMember() { - } - - public StructureMember lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this structure member - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public StructureMember name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the structure member - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public StructureMember offset(@javax.annotation.Nonnull Integer offset) { - this.offset = offset; - return this; - } - - /** - * Offset of the member within the structure - * @return offset - */ - @javax.annotation.Nonnull - public Integer getOffset() { - return offset; - } - - public void setOffset(@javax.annotation.Nonnull Integer offset) { - this.offset = offset; - } - - - public StructureMember type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Data type of the structure member - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public StructureMember size(@javax.annotation.Nonnull Integer size) { - this.size = size; - return this; - } - - /** - * Size of the structure member in bytes - * @return size - */ - @javax.annotation.Nonnull - public Integer getSize() { - return size; - } - - public void setSize(@javax.annotation.Nonnull Integer size) { - this.size = size; - } - - /** - * 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 StructureMember instance itself - */ - public StructureMember 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; - } - StructureMember structureMember = (StructureMember) o; - return Objects.equals(this.lastChange, structureMember.lastChange) && - Objects.equals(this.name, structureMember.name) && - Objects.equals(this.offset, structureMember.offset) && - Objects.equals(this.type, structureMember.type) && - Objects.equals(this.size, structureMember.size)&& - Objects.equals(this.additionalProperties, structureMember.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, name, offset, type, size, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class StructureMember {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).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("last_change", "name", "offset", "type", "size")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "offset", "type", "size")); - } - - /** - * 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 StructureMember - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!StructureMember.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 StructureMember is not found in the empty JSON string", StructureMember.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : StructureMember.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!StructureMember.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'StructureMember' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(StructureMember.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, StructureMember 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 StructureMember read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - StructureMember 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 StructureMember given an JSON string - * - * @param jsonString JSON string - * @return An instance of StructureMember - * @throws IOException if the JSON string is invalid with respect to StructureMember - */ - public static StructureMember fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, StructureMember.class); - } - - /** - * Convert an instance of StructureMember to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/ReplacementValue.java b/src/main/java/ai/reveng/model/Token.java similarity index 76% rename from src/main/java/ai/reveng/model/ReplacementValue.java rename to src/main/java/ai/reveng/model/Token.java index 8e9a93dd..ed0eb2d0 100644 --- a/src/main/java/ai/reveng/model/ReplacementValue.java +++ b/src/main/java/ai/reveng/model/Token.java @@ -45,25 +45,25 @@ import ai.reveng.invoker.JSON; /** - * ReplacementValue + * Token */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class ReplacementValue { +public class Token { public static final String SERIALIZED_NAME_VALUE = "value"; @SerializedName(SERIALIZED_NAME_VALUE) @javax.annotation.Nonnull private String value; - public ReplacementValue() { + public Token() { } - public ReplacementValue value(@javax.annotation.Nonnull String value) { + public Token value(@javax.annotation.Nonnull String value) { this.value = value; return this; } /** - * Get value + * Name the token resolves to. An empty string in a request removes the override. * @return value */ @javax.annotation.Nonnull @@ -85,8 +85,8 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - ReplacementValue replacementValue = (ReplacementValue) o; - return Objects.equals(this.value, replacementValue.value); + Token token = (Token) o; + return Objects.equals(this.value, token.value); } @Override @@ -97,7 +97,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class ReplacementValue {\n"); + sb.append("class Token {\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); sb.append("}"); return sb.toString(); @@ -127,25 +127,25 @@ private String toIndentedString(Object o) { * 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 ReplacementValue + * @throws IOException if the JSON Element is invalid with respect to Token */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!ReplacementValue.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 ReplacementValue is not found in the empty JSON string", ReplacementValue.openapiRequiredFields.toString())); + if (!Token.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 Token is not found in the empty JSON string", Token.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!ReplacementValue.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `ReplacementValue` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!Token.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `Token` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ReplacementValue.openapiRequiredFields) { + for (String requiredField : Token.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())); } @@ -160,22 +160,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!ReplacementValue.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ReplacementValue' and its subtypes + if (!Token.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Token' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ReplacementValue.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Token.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, ReplacementValue value) throws IOException { + public void write(JsonWriter out, Token value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public ReplacementValue read(JsonReader in) throws IOException { + public Token read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -186,18 +186,18 @@ public ReplacementValue read(JsonReader in) throws IOException { } /** - * Create an instance of ReplacementValue given an JSON string + * Create an instance of Token given an JSON string * * @param jsonString JSON string - * @return An instance of ReplacementValue - * @throws IOException if the JSON string is invalid with respect to ReplacementValue + * @return An instance of Token + * @throws IOException if the JSON string is invalid with respect to Token */ - public static ReplacementValue fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ReplacementValue.class); + public static Token fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Token.class); } /** - * Convert an instance of ReplacementValue to an JSON string + * Convert an instance of Token to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/TokenisedData.java b/src/main/java/ai/reveng/model/TokenisedData.java index 25f7b250..7f74fb76 100644 --- a/src/main/java/ai/reveng/model/TokenisedData.java +++ b/src/main/java/ai/reveng/model/TokenisedData.java @@ -13,14 +13,17 @@ package ai.reveng.model; import java.util.Objects; -import ai.reveng.model.AIDecompFunctionMapping; +import ai.reveng.model.ResolvedEntity; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -50,10 +53,15 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class TokenisedData { - public static final String SERIALIZED_NAME_FUNCTION_MAPPING = "function_mapping"; - @SerializedName(SERIALIZED_NAME_FUNCTION_MAPPING) + public static final String SERIALIZED_NAME_ENTITIES = "entities"; + @SerializedName(SERIALIZED_NAME_ENTITIES) + @javax.annotation.Nullable + private List entities; + + public static final String SERIALIZED_NAME_LINE_ATTRIBUTION = "line_attribution"; + @SerializedName(SERIALIZED_NAME_LINE_ATTRIBUTION) @javax.annotation.Nullable - private AIDecompFunctionMapping functionMapping; + private Object lineAttribution = null; public static final String SERIALIZED_NAME_PREDICTED_FUNCTION_NAME = "predicted_function_name"; @SerializedName(SERIALIZED_NAME_PREDICTED_FUNCTION_NAME) @@ -133,22 +141,49 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti public TokenisedData() { } - public TokenisedData functionMapping(@javax.annotation.Nullable AIDecompFunctionMapping functionMapping) { - this.functionMapping = functionMapping; + public TokenisedData entities(@javax.annotation.Nullable List entities) { + this.entities = entities; + return this; + } + + public TokenisedData addEntitiesItem(ResolvedEntity entitiesItem) { + if (this.entities == null) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * One entry per token in the tokenised source, with the name it resolves to and its hover metadata. + * @return entities + */ + @javax.annotation.Nullable + public List getEntities() { + return entities; + } + + public void setEntities(@javax.annotation.Nullable List entities) { + this.entities = entities; + } + + + public TokenisedData lineAttribution(@javax.annotation.Nullable Object lineAttribution) { + this.lineAttribution = lineAttribution; return this; } /** - * Complete mapping data for token resolution - * @return functionMapping + * Get lineAttribution + * @return lineAttribution */ @javax.annotation.Nullable - public AIDecompFunctionMapping getFunctionMapping() { - return functionMapping; + public Object getLineAttribution() { + return lineAttribution; } - public void setFunctionMapping(@javax.annotation.Nullable AIDecompFunctionMapping functionMapping) { - this.functionMapping = functionMapping; + public void setLineAttribution(@javax.annotation.Nullable Object lineAttribution) { + this.lineAttribution = lineAttribution; } @@ -208,6 +243,50 @@ public void setTokenisedDecompilation(@javax.annotation.Nullable String tokenise this.tokenisedDecompilation = tokenisedDecompilation; } + /** + * 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 TokenisedData instance itself + */ + public TokenisedData 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 @@ -219,25 +298,40 @@ public boolean equals(Object o) { return false; } TokenisedData tokenisedData = (TokenisedData) o; - return Objects.equals(this.functionMapping, tokenisedData.functionMapping) && + return Objects.equals(this.entities, tokenisedData.entities) && + Objects.equals(this.lineAttribution, tokenisedData.lineAttribution) && Objects.equals(this.predictedFunctionName, tokenisedData.predictedFunctionName) && Objects.equals(this.status, tokenisedData.status) && - Objects.equals(this.tokenisedDecompilation, tokenisedData.tokenisedDecompilation); + Objects.equals(this.tokenisedDecompilation, tokenisedData.tokenisedDecompilation)&& + Objects.equals(this.additionalProperties, tokenisedData.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); } @Override public int hashCode() { - return Objects.hash(functionMapping, predictedFunctionName, status, tokenisedDecompilation); + return Objects.hash(entities, lineAttribution, predictedFunctionName, status, tokenisedDecompilation, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TokenisedData {\n"); - sb.append(" functionMapping: ").append(toIndentedString(functionMapping)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); + sb.append(" lineAttribution: ").append(toIndentedString(lineAttribution)).append("\n"); sb.append(" predictedFunctionName: ").append(toIndentedString(predictedFunctionName)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" tokenisedDecompilation: ").append(toIndentedString(tokenisedDecompilation)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); } @@ -256,7 +350,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("function_mapping", "predicted_function_name", "status", "tokenised_decompilation")); + openapiFields = new HashSet(Arrays.asList("entities", "line_attribution", "predicted_function_name", "status", "tokenised_decompilation")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(Arrays.asList("status")); @@ -275,14 +369,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TokenisedData.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TokenisedData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); - } - } - // check to make sure all required properties/fields are present in the JSON string for (String requiredField : TokenisedData.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { @@ -290,9 +376,19 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `function_mapping` - if (jsonObj.get("function_mapping") != null && !jsonObj.get("function_mapping").isJsonNull()) { - AIDecompFunctionMapping.validateJsonElement(jsonObj.get("function_mapping")); + if (jsonObj.get("entities") != null && !jsonObj.get("entities").isJsonNull()) { + JsonArray jsonArrayentities = jsonObj.getAsJsonArray("entities"); + if (jsonArrayentities != null) { + // ensure the json data is an array + if (!jsonObj.get("entities").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `entities` to be an array in the JSON string but got `%s`", jsonObj.get("entities").toString())); + } + + // validate the optional field `entities` (array) + for (int i = 0; i < jsonArrayentities.size(); i++) { + ResolvedEntity.validateJsonElement(jsonArrayentities.get(i)); + }; + } } if ((jsonObj.get("predicted_function_name") != null && !jsonObj.get("predicted_function_name").isJsonNull()) && !jsonObj.get("predicted_function_name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `predicted_function_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("predicted_function_name").toString())); @@ -322,6 +418,28 @@ public TypeAdapter create(Gson gson, TypeToken type) { @Override public void write(JsonWriter out, TokenisedData 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); } @@ -329,7 +447,28 @@ public void write(JsonWriter out, TokenisedData value) throws IOException { public TokenisedData read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TokenisedData 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(); diff --git a/src/main/java/ai/reveng/model/TriggerRenameUnnamedFunctionsInputBody.java b/src/main/java/ai/reveng/model/TriggerRenameUnnamedFunctionsInputBody.java new file mode 100644 index 00000000..cb60c4e5 --- /dev/null +++ b/src/main/java/ai/reveng/model/TriggerRenameUnnamedFunctionsInputBody.java @@ -0,0 +1,199 @@ +/* + * 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; + +/** + * TriggerRenameUnnamedFunctionsInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TriggerRenameUnnamedFunctionsInputBody { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + @javax.annotation.Nullable + private Long limit; + + public TriggerRenameUnnamedFunctionsInputBody() { + } + + public TriggerRenameUnnamedFunctionsInputBody limit(@javax.annotation.Nullable Long limit) { + this.limit = limit; + return this; + } + + /** + * Stop after this many functions. Omit to process every unnamed function in the analysis. + * minimum: 1 + * @return limit + */ + @javax.annotation.Nullable + public Long getLimit() { + return limit; + } + + public void setLimit(@javax.annotation.Nullable Long limit) { + this.limit = limit; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TriggerRenameUnnamedFunctionsInputBody triggerRenameUnnamedFunctionsInputBody = (TriggerRenameUnnamedFunctionsInputBody) o; + return Objects.equals(this.limit, triggerRenameUnnamedFunctionsInputBody.limit); + } + + @Override + public int hashCode() { + return Objects.hash(limit); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriggerRenameUnnamedFunctionsInputBody {\n"); + sb.append(" limit: ").append(toIndentedString(limit)).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("limit")); + + // 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 TriggerRenameUnnamedFunctionsInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TriggerRenameUnnamedFunctionsInputBody.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 TriggerRenameUnnamedFunctionsInputBody is not found in the empty JSON string", TriggerRenameUnnamedFunctionsInputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TriggerRenameUnnamedFunctionsInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TriggerRenameUnnamedFunctionsInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TriggerRenameUnnamedFunctionsInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TriggerRenameUnnamedFunctionsInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TriggerRenameUnnamedFunctionsInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TriggerRenameUnnamedFunctionsInputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TriggerRenameUnnamedFunctionsInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TriggerRenameUnnamedFunctionsInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of TriggerRenameUnnamedFunctionsInputBody + * @throws IOException if the JSON string is invalid with respect to TriggerRenameUnnamedFunctionsInputBody + */ + public static TriggerRenameUnnamedFunctionsInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TriggerRenameUnnamedFunctionsInputBody.class); + } + + /** + * Convert an instance of TriggerRenameUnnamedFunctionsInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TypeDefinition.java b/src/main/java/ai/reveng/model/TypeDefinition.java deleted file mode 100644 index f7e29f5a..00000000 --- a/src/main/java/ai/reveng/model/TypeDefinition.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * 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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * TypeDefinition - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class TypeDefinition { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_ARTIFACT_TYPE = "artifact_type"; - @SerializedName(SERIALIZED_NAME_ARTIFACT_TYPE) - @javax.annotation.Nullable - private String artifactType; - - public TypeDefinition() { - } - - public TypeDefinition lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this type definition - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public TypeDefinition name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the type definition - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public TypeDefinition type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Underlying type of the type definition - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public TypeDefinition artifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - return this; - } - - /** - * Type of artifact the type definition is associated with - * @return artifactType - */ - @javax.annotation.Nullable - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - } - - /** - * 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 TypeDefinition instance itself - */ - public TypeDefinition 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; - } - TypeDefinition typeDefinition = (TypeDefinition) o; - return Objects.equals(this.lastChange, typeDefinition.lastChange) && - Objects.equals(this.name, typeDefinition.name) && - Objects.equals(this.type, typeDefinition.type) && - Objects.equals(this.artifactType, typeDefinition.artifactType)&& - Objects.equals(this.additionalProperties, typeDefinition.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, name, type, artifactType, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TypeDefinition {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" artifactType: ").append(toIndentedString(artifactType)).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("last_change", "name", "type", "artifact_type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "type")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to TypeDefinition - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!TypeDefinition.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 TypeDefinition is not found in the empty JSON string", TypeDefinition.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : TypeDefinition.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if ((jsonObj.get("artifact_type") != null && !jsonObj.get("artifact_type").isJsonNull()) && !jsonObj.get("artifact_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `artifact_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("artifact_type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TypeDefinition.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TypeDefinition' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(TypeDefinition.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, TypeDefinition 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 TypeDefinition read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - TypeDefinition 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 TypeDefinition given an JSON string - * - * @param jsonString JSON string - * @return An instance of TypeDefinition - * @throws IOException if the JSON string is invalid with respect to TypeDefinition - */ - public static TypeDefinition fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TypeDefinition.class); - } - - /** - * Convert an instance of TypeDefinition to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/TypedefDataType.java b/src/main/java/ai/reveng/model/TypedefDataType.java new file mode 100644 index 00000000..d84e895e --- /dev/null +++ b/src/main/java/ai/reveng/model/TypedefDataType.java @@ -0,0 +1,571 @@ +/* + * 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.TypedefDefinition; +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; + +/** + * TypedefDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TypedefDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private TypedefDefinition definition; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + TYPEDEF("TYPEDEF"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public TypedefDataType() { + } + + public TypedefDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public TypedefDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public TypedefDataType definition(@javax.annotation.Nullable TypedefDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Absent only for a type referenced but never defined. + * @return definition + */ + @javax.annotation.Nullable + public TypedefDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable TypedefDefinition definition) { + this.definition = definition; + } + + + public TypedefDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public TypedefDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public TypedefDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public TypedefDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public TypedefDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public TypedefDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public TypedefDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypedefDataType typedefDataType = (TypedefDataType) o; + return Objects.equals(this.createdAt, typedefDataType.createdAt) && + Objects.equals(this.dataTypeId, typedefDataType.dataTypeId) && + Objects.equals(this.definition, typedefDataType.definition) && + Objects.equals(this.hasDefinition, typedefDataType.hasDefinition) && + Objects.equals(this.kind, typedefDataType.kind) && + Objects.equals(this.name, typedefDataType.name) && + Objects.equals(this.namespace, typedefDataType.namespace) && + Objects.equals(this.size, typedefDataType.size) && + Objects.equals(this.sourceFunctionId, typedefDataType.sourceFunctionId) && + Objects.equals(this.sourceType, typedefDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, definition, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypedefDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "definition", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TypedefDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypedefDataType.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 TypedefDataType is not found in the empty JSON string", TypedefDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TypedefDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TypedefDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TypedefDataType.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(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + TypedefDefinition.validateJsonElement(jsonObj.get("definition")); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypedefDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypedefDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypedefDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypedefDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TypedefDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TypedefDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypedefDataType + * @throws IOException if the JSON string is invalid with respect to TypedefDataType + */ + public static TypedefDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypedefDataType.class); + } + + /** + * Convert an instance of TypedefDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/TypedefDefinition.java b/src/main/java/ai/reveng/model/TypedefDefinition.java new file mode 100644 index 00000000..8e87d4c3 --- /dev/null +++ b/src/main/java/ai/reveng/model/TypedefDefinition.java @@ -0,0 +1,198 @@ +/* + * 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; + +/** + * TypedefDefinition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class TypedefDefinition { + public static final String SERIALIZED_NAME_TARGET_DATA_TYPE_ID = "target_data_type_id"; + @SerializedName(SERIALIZED_NAME_TARGET_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long targetDataTypeId; + + public TypedefDefinition() { + } + + public TypedefDefinition targetDataTypeId(@javax.annotation.Nullable Long targetDataTypeId) { + this.targetDataTypeId = targetDataTypeId; + return this; + } + + /** + * The type being aliased. + * @return targetDataTypeId + */ + @javax.annotation.Nullable + public Long getTargetDataTypeId() { + return targetDataTypeId; + } + + public void setTargetDataTypeId(@javax.annotation.Nullable Long targetDataTypeId) { + this.targetDataTypeId = targetDataTypeId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TypedefDefinition typedefDefinition = (TypedefDefinition) o; + return Objects.equals(this.targetDataTypeId, typedefDefinition.targetDataTypeId); + } + + @Override + public int hashCode() { + return Objects.hash(targetDataTypeId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypedefDefinition {\n"); + sb.append(" targetDataTypeId: ").append(toIndentedString(targetDataTypeId)).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("target_data_type_id")); + + // 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 TypedefDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypedefDefinition.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 TypedefDefinition is not found in the empty JSON string", TypedefDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TypedefDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `TypedefDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypedefDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypedefDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypedefDefinition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypedefDefinition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TypedefDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TypedefDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypedefDefinition + * @throws IOException if the JSON string is invalid with respect to TypedefDefinition + */ + public static TypedefDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypedefDefinition.class); + } + + /** + * Convert an instance of TypedefDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UnionDataType.java b/src/main/java/ai/reveng/model/UnionDataType.java new file mode 100644 index 00000000..98e9328c --- /dev/null +++ b/src/main/java/ai/reveng/model/UnionDataType.java @@ -0,0 +1,571 @@ +/* + * 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.UnionDefinition; +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; + +/** + * UnionDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnionDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nullable + private UnionDefinition definition; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + UNION("UNION"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public UnionDataType() { + } + + public UnionDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public UnionDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UnionDataType definition(@javax.annotation.Nullable UnionDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Absent only for a type referenced but never defined. + * @return definition + */ + @javax.annotation.Nullable + public UnionDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nullable UnionDefinition definition) { + this.definition = definition; + } + + + public UnionDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public UnionDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UnionDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UnionDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public UnionDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public UnionDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public UnionDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnionDataType unionDataType = (UnionDataType) o; + return Objects.equals(this.createdAt, unionDataType.createdAt) && + Objects.equals(this.dataTypeId, unionDataType.dataTypeId) && + Objects.equals(this.definition, unionDataType.definition) && + Objects.equals(this.hasDefinition, unionDataType.hasDefinition) && + Objects.equals(this.kind, unionDataType.kind) && + Objects.equals(this.name, unionDataType.name) && + Objects.equals(this.namespace, unionDataType.namespace) && + Objects.equals(this.size, unionDataType.size) && + Objects.equals(this.sourceFunctionId, unionDataType.sourceFunctionId) && + Objects.equals(this.sourceType, unionDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, definition, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnionDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "definition", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnionDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnionDataType.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 UnionDataType is not found in the empty JSON string", UnionDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnionDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UnionDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UnionDataType.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(); + // validate the optional field `definition` + if (jsonObj.get("definition") != null && !jsonObj.get("definition").isJsonNull()) { + UnionDefinition.validateJsonElement(jsonObj.get("definition")); + } + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnionDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnionDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnionDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnionDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnionDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnionDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnionDataType + * @throws IOException if the JSON string is invalid with respect to UnionDataType + */ + public static UnionDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnionDataType.class); + } + + /** + * Convert an instance of UnionDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UnionDefinition.java b/src/main/java/ai/reveng/model/UnionDefinition.java new file mode 100644 index 00000000..2ff33f01 --- /dev/null +++ b/src/main/java/ai/reveng/model/UnionDefinition.java @@ -0,0 +1,226 @@ +/* + * 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.DataTypeMemberEntry; +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; + +/** + * UnionDefinition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnionDefinition { + public static final String SERIALIZED_NAME_MEMBERS = "members"; + @SerializedName(SERIALIZED_NAME_MEMBERS) + @javax.annotation.Nullable + private List members; + + public UnionDefinition() { + } + + public UnionDefinition members(@javax.annotation.Nullable List members) { + this.members = members; + return this; + } + + public UnionDefinition addMembersItem(DataTypeMemberEntry membersItem) { + if (this.members == null) { + this.members = new ArrayList<>(); + } + this.members.add(membersItem); + return this; + } + + /** + * The type's fields. Every member starts at offset 0. + * @return members + */ + @javax.annotation.Nullable + public List getMembers() { + return members; + } + + public void setMembers(@javax.annotation.Nullable List members) { + this.members = members; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnionDefinition unionDefinition = (UnionDefinition) o; + return Objects.equals(this.members, unionDefinition.members); + } + + @Override + public int hashCode() { + return Objects.hash(members); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnionDefinition {\n"); + sb.append(" members: ").append(toIndentedString(members)).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("members")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("members")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnionDefinition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnionDefinition.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 UnionDefinition is not found in the empty JSON string", UnionDefinition.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnionDefinition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UnionDefinition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UnionDefinition.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("members") != null && !jsonObj.get("members").isJsonNull()) { + if (!jsonObj.get("members").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `members` to be an array in the JSON string but got `%s`", jsonObj.get("members").toString())); + } + JsonArray jsonArraymembers = jsonObj.getAsJsonArray("members"); + // validate the required field `members` (array) + for (int i = 0; i < jsonArraymembers.size(); i++) { + DataTypeMemberEntry.validateJsonElement(jsonArraymembers.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnionDefinition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnionDefinition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnionDefinition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnionDefinition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnionDefinition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnionDefinition given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnionDefinition + * @throws IOException if the JSON string is invalid with respect to UnionDefinition + */ + public static UnionDefinition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnionDefinition.class); + } + + /** + * Convert an instance of UnionDefinition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UnknownDataType.java b/src/main/java/ai/reveng/model/UnknownDataType.java new file mode 100644 index 00000000..5ef301de --- /dev/null +++ b/src/main/java/ai/reveng/model/UnknownDataType.java @@ -0,0 +1,540 @@ +/* + * 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; + +/** + * UnknownDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UnknownDataType { + 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_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_HAS_DEFINITION = "has_definition"; + @SerializedName(SERIALIZED_NAME_HAS_DEFINITION) + @javax.annotation.Nonnull + private Boolean hasDefinition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + UNKNOWN("UNKNOWN"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nonnull + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public static final String SERIALIZED_NAME_SOURCE_FUNCTION_ID = "source_function_id"; + @SerializedName(SERIALIZED_NAME_SOURCE_FUNCTION_ID) + @javax.annotation.Nullable + private Long sourceFunctionId; + + /** + * Where this type came from. + */ + @JsonAdapter(SourceTypeEnum.Adapter.class) + public enum SourceTypeEnum { + SYSTEM("SYSTEM"), + + USER("USER"), + + AUTO_UNSTRIP("AUTO_UNSTRIP"), + + AI_DECOMP("AI_DECOMP"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + SourceTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static SourceTypeEnum fromValue(String value) { + for (SourceTypeEnum b : SourceTypeEnum.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 SourceTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public SourceTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SourceTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SourceTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_SOURCE_TYPE = "source_type"; + @SerializedName(SERIALIZED_NAME_SOURCE_TYPE) + @javax.annotation.Nonnull + private SourceTypeEnum sourceType; + + public UnknownDataType() { + } + + public UnknownDataType createdAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * When this type was extracted. + * @return createdAt + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nonnull OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public UnknownDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * Identifies the type within its analysis. 0 is a valid id. + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UnknownDataType hasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + return this; + } + + /** + * Whether this type carries a definition. False for the kinds that never have one and for a type referenced but never defined. + * @return hasDefinition + */ + @javax.annotation.Nonnull + public Boolean getHasDefinition() { + return hasDefinition; + } + + public void setHasDefinition(@javax.annotation.Nonnull Boolean hasDefinition) { + this.hasDefinition = hasDefinition; + } + + + public UnknownDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UnknownDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UnknownDataType namespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Empty for a program-defined type. + * @return namespace + */ + @javax.annotation.Nonnull + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nonnull String namespace) { + this.namespace = namespace; + } + + + public UnknownDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes, absent when it could not be determined. + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + public UnknownDataType sourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + return this; + } + + /** + * The function this type was copied from, when transferred rather than extracted. + * @return sourceFunctionId + */ + @javax.annotation.Nullable + public Long getSourceFunctionId() { + return sourceFunctionId; + } + + public void setSourceFunctionId(@javax.annotation.Nullable Long sourceFunctionId) { + this.sourceFunctionId = sourceFunctionId; + } + + + public UnknownDataType sourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Where this type came from. + * @return sourceType + */ + @javax.annotation.Nonnull + public SourceTypeEnum getSourceType() { + return sourceType; + } + + public void setSourceType(@javax.annotation.Nonnull SourceTypeEnum sourceType) { + this.sourceType = sourceType; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UnknownDataType unknownDataType = (UnknownDataType) o; + return Objects.equals(this.createdAt, unknownDataType.createdAt) && + Objects.equals(this.dataTypeId, unknownDataType.dataTypeId) && + Objects.equals(this.hasDefinition, unknownDataType.hasDefinition) && + Objects.equals(this.kind, unknownDataType.kind) && + Objects.equals(this.name, unknownDataType.name) && + Objects.equals(this.namespace, unknownDataType.namespace) && + Objects.equals(this.size, unknownDataType.size) && + Objects.equals(this.sourceFunctionId, unknownDataType.sourceFunctionId) && + Objects.equals(this.sourceType, unknownDataType.sourceType); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, dataTypeId, hasDefinition, kind, name, namespace, size, sourceFunctionId, sourceType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UnknownDataType {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" hasDefinition: ").append(toIndentedString(hasDefinition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" sourceFunctionId: ").append(toIndentedString(sourceFunctionId)).append("\n"); + sb.append(" sourceType: ").append(toIndentedString(sourceType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "size", "source_function_id", "source_type")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("created_at", "data_type_id", "has_definition", "kind", "name", "namespace", "source_type")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UnknownDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UnknownDataType.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 UnknownDataType is not found in the empty JSON string", UnknownDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UnknownDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UnknownDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UnknownDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + if (!jsonObj.get("source_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `source_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_type").toString())); + } + // validate the required field `source_type` + SourceTypeEnum.validateJsonElement(jsonObj.get("source_type")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UnknownDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UnknownDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UnknownDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UnknownDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UnknownDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UnknownDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UnknownDataType + * @throws IOException if the JSON string is invalid with respect to UnknownDataType + */ + public static UnknownDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UnknownDataType.class); + } + + /** + * Convert an instance of UnknownDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateAnalysisDataTypesInputBody.java b/src/main/java/ai/reveng/model/UpdateAnalysisDataTypesInputBody.java new file mode 100644 index 00000000..637cdddc --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateAnalysisDataTypesInputBody.java @@ -0,0 +1,226 @@ +/* + * 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.UpdateDataTypeEntry; +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; + +/** + * UpdateAnalysisDataTypesInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateAnalysisDataTypesInputBody { + public static final String SERIALIZED_NAME_DATA_TYPES = "data_types"; + @SerializedName(SERIALIZED_NAME_DATA_TYPES) + @javax.annotation.Nullable + private List dataTypes; + + public UpdateAnalysisDataTypesInputBody() { + } + + public UpdateAnalysisDataTypesInputBody dataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + return this; + } + + public UpdateAnalysisDataTypesInputBody addDataTypesItem(UpdateDataTypeEntry dataTypesItem) { + if (this.dataTypes == null) { + this.dataTypes = new ArrayList<>(); + } + this.dataTypes.add(dataTypesItem); + return this; + } + + /** + * The replacements. Every data_type_id must belong to the analysis, and none may repeat. + * @return dataTypes + */ + @javax.annotation.Nullable + public List getDataTypes() { + return dataTypes; + } + + public void setDataTypes(@javax.annotation.Nullable List dataTypes) { + this.dataTypes = dataTypes; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAnalysisDataTypesInputBody updateAnalysisDataTypesInputBody = (UpdateAnalysisDataTypesInputBody) o; + return Objects.equals(this.dataTypes, updateAnalysisDataTypesInputBody.dataTypes); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypes); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAnalysisDataTypesInputBody {\n"); + sb.append(" dataTypes: ").append(toIndentedString(dataTypes)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_types")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_types")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateAnalysisDataTypesInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAnalysisDataTypesInputBody.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 UpdateAnalysisDataTypesInputBody is not found in the empty JSON string", UpdateAnalysisDataTypesInputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAnalysisDataTypesInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateAnalysisDataTypesInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateAnalysisDataTypesInputBody.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("data_types") != null && !jsonObj.get("data_types").isJsonNull()) { + if (!jsonObj.get("data_types").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data_types` to be an array in the JSON string but got `%s`", jsonObj.get("data_types").toString())); + } + JsonArray jsonArraydataTypes = jsonObj.getAsJsonArray("data_types"); + // validate the required field `data_types` (array) + for (int i = 0; i < jsonArraydataTypes.size(); i++) { + UpdateDataTypeEntry.validateJsonElement(jsonArraydataTypes.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAnalysisDataTypesInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAnalysisDataTypesInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateAnalysisDataTypesInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAnalysisDataTypesInputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAnalysisDataTypesInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAnalysisDataTypesInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAnalysisDataTypesInputBody + * @throws IOException if the JSON string is invalid with respect to UpdateAnalysisDataTypesInputBody + */ + public static UpdateAnalysisDataTypesInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAnalysisDataTypesInputBody.class); + } + + /** + * Convert an instance of UpdateAnalysisDataTypesInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateArrayDataType.java b/src/main/java/ai/reveng/model/UpdateArrayDataType.java new file mode 100644 index 00000000..5c759e0e --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateArrayDataType.java @@ -0,0 +1,403 @@ +/* + * 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.ArrayDefinition; +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; + +/** + * UpdateArrayDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateArrayDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private ArrayDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + ARRAY("ARRAY"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateArrayDataType() { + } + + public UpdateArrayDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateArrayDataType definition(@javax.annotation.Nonnull ArrayDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public ArrayDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull ArrayDefinition definition) { + this.definition = definition; + } + + + public UpdateArrayDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateArrayDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateArrayDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateArrayDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateArrayDataType updateArrayDataType = (UpdateArrayDataType) o; + return Objects.equals(this.dataTypeId, updateArrayDataType.dataTypeId) && + Objects.equals(this.definition, updateArrayDataType.definition) && + Objects.equals(this.kind, updateArrayDataType.kind) && + Objects.equals(this.name, updateArrayDataType.name) && + Objects.equals(this.namespace, updateArrayDataType.namespace) && + Objects.equals(this.size, updateArrayDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateArrayDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "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 UpdateArrayDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateArrayDataType.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 UpdateArrayDataType is not found in the empty JSON string", UpdateArrayDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateArrayDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateArrayDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateArrayDataType.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(); + // validate the required field `definition` + ArrayDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateArrayDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateArrayDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateArrayDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateArrayDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateArrayDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateArrayDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateArrayDataType + * @throws IOException if the JSON string is invalid with respect to UpdateArrayDataType + */ + public static UpdateArrayDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateArrayDataType.class); + } + + /** + * Convert an instance of UpdateArrayDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateBaseDataType.java b/src/main/java/ai/reveng/model/UpdateBaseDataType.java new file mode 100644 index 00000000..7db329f7 --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateBaseDataType.java @@ -0,0 +1,374 @@ +/* + * 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; + +/** + * UpdateBaseDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateBaseDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + BASE("BASE"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateBaseDataType() { + } + + public UpdateBaseDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateBaseDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateBaseDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateBaseDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateBaseDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateBaseDataType updateBaseDataType = (UpdateBaseDataType) o; + return Objects.equals(this.dataTypeId, updateBaseDataType.dataTypeId) && + Objects.equals(this.kind, updateBaseDataType.kind) && + Objects.equals(this.name, updateBaseDataType.name) && + Objects.equals(this.namespace, updateBaseDataType.namespace) && + Objects.equals(this.size, updateBaseDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateBaseDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "kind", "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 UpdateBaseDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateBaseDataType.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 UpdateBaseDataType is not found in the empty JSON string", UpdateBaseDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateBaseDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateBaseDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateBaseDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateBaseDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateBaseDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateBaseDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateBaseDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateBaseDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateBaseDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateBaseDataType + * @throws IOException if the JSON string is invalid with respect to UpdateBaseDataType + */ + public static UpdateBaseDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateBaseDataType.class); + } + + /** + * Convert an instance of UpdateBaseDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateBitfieldDataType.java b/src/main/java/ai/reveng/model/UpdateBitfieldDataType.java new file mode 100644 index 00000000..9bcae302 --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateBitfieldDataType.java @@ -0,0 +1,374 @@ +/* + * 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; + +/** + * UpdateBitfieldDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateBitfieldDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + BITFIELD("BITFIELD"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateBitfieldDataType() { + } + + public UpdateBitfieldDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateBitfieldDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateBitfieldDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateBitfieldDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateBitfieldDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateBitfieldDataType updateBitfieldDataType = (UpdateBitfieldDataType) o; + return Objects.equals(this.dataTypeId, updateBitfieldDataType.dataTypeId) && + Objects.equals(this.kind, updateBitfieldDataType.kind) && + Objects.equals(this.name, updateBitfieldDataType.name) && + Objects.equals(this.namespace, updateBitfieldDataType.namespace) && + Objects.equals(this.size, updateBitfieldDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateBitfieldDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "kind", "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 UpdateBitfieldDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateBitfieldDataType.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 UpdateBitfieldDataType is not found in the empty JSON string", UpdateBitfieldDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateBitfieldDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateBitfieldDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateBitfieldDataType.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateBitfieldDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateBitfieldDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateBitfieldDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateBitfieldDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateBitfieldDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateBitfieldDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateBitfieldDataType + * @throws IOException if the JSON string is invalid with respect to UpdateBitfieldDataType + */ + public static UpdateBitfieldDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateBitfieldDataType.class); + } + + /** + * Convert an instance of UpdateBitfieldDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateDataTypeEntry.java b/src/main/java/ai/reveng/model/UpdateDataTypeEntry.java new file mode 100644 index 00000000..9742286d --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateDataTypeEntry.java @@ -0,0 +1,645 @@ +/* + * 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.FunctionTypeDefinition; +import ai.reveng.model.UpdateArrayDataType; +import ai.reveng.model.UpdateBaseDataType; +import ai.reveng.model.UpdateBitfieldDataType; +import ai.reveng.model.UpdateEnumDataType; +import ai.reveng.model.UpdateFunctionDataType; +import ai.reveng.model.UpdatePointerDataType; +import ai.reveng.model.UpdateStructDataType; +import ai.reveng.model.UpdateTypedefDataType; +import ai.reveng.model.UpdateUnionDataType; +import ai.reveng.model.UpdateUnknownDataType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import ai.reveng.invoker.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateDataTypeEntry extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(UpdateDataTypeEntry.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateDataTypeEntry.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateDataTypeEntry' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterUpdateStructDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateStructDataType.class)); + final TypeAdapter adapterUpdateUnionDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateUnionDataType.class)); + final TypeAdapter adapterUpdateEnumDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateEnumDataType.class)); + final TypeAdapter adapterUpdateTypedefDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateTypedefDataType.class)); + final TypeAdapter adapterUpdatePointerDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdatePointerDataType.class)); + final TypeAdapter adapterUpdateArrayDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateArrayDataType.class)); + final TypeAdapter adapterUpdateFunctionDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateFunctionDataType.class)); + final TypeAdapter adapterUpdateBitfieldDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateBitfieldDataType.class)); + final TypeAdapter adapterUpdateBaseDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateBaseDataType.class)); + final TypeAdapter adapterUpdateUnknownDataType = gson.getDelegateAdapter(this, TypeToken.get(UpdateUnknownDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateDataTypeEntry value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `UpdateStructDataType` + if (value.getActualInstance() instanceof UpdateStructDataType) { + JsonElement element = adapterUpdateStructDataType.toJsonTree((UpdateStructDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateUnionDataType` + if (value.getActualInstance() instanceof UpdateUnionDataType) { + JsonElement element = adapterUpdateUnionDataType.toJsonTree((UpdateUnionDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateEnumDataType` + if (value.getActualInstance() instanceof UpdateEnumDataType) { + JsonElement element = adapterUpdateEnumDataType.toJsonTree((UpdateEnumDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateTypedefDataType` + if (value.getActualInstance() instanceof UpdateTypedefDataType) { + JsonElement element = adapterUpdateTypedefDataType.toJsonTree((UpdateTypedefDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdatePointerDataType` + if (value.getActualInstance() instanceof UpdatePointerDataType) { + JsonElement element = adapterUpdatePointerDataType.toJsonTree((UpdatePointerDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateArrayDataType` + if (value.getActualInstance() instanceof UpdateArrayDataType) { + JsonElement element = adapterUpdateArrayDataType.toJsonTree((UpdateArrayDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateFunctionDataType` + if (value.getActualInstance() instanceof UpdateFunctionDataType) { + JsonElement element = adapterUpdateFunctionDataType.toJsonTree((UpdateFunctionDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateBitfieldDataType` + if (value.getActualInstance() instanceof UpdateBitfieldDataType) { + JsonElement element = adapterUpdateBitfieldDataType.toJsonTree((UpdateBitfieldDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateBaseDataType` + if (value.getActualInstance() instanceof UpdateBaseDataType) { + JsonElement element = adapterUpdateBaseDataType.toJsonTree((UpdateBaseDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `UpdateUnknownDataType` + if (value.getActualInstance() instanceof UpdateUnknownDataType) { + JsonElement element = adapterUpdateUnknownDataType.toJsonTree((UpdateUnknownDataType)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: UpdateArrayDataType, UpdateBaseDataType, UpdateBitfieldDataType, UpdateEnumDataType, UpdateFunctionDataType, UpdatePointerDataType, UpdateStructDataType, UpdateTypedefDataType, UpdateUnionDataType, UpdateUnknownDataType"); + } + + @Override + public UpdateDataTypeEntry read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize UpdateStructDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateStructDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateStructDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateStructDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateStructDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateStructDataType'", e); + } + // deserialize UpdateUnionDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateUnionDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateUnionDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateUnionDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateUnionDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateUnionDataType'", e); + } + // deserialize UpdateEnumDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateEnumDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateEnumDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateEnumDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateEnumDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateEnumDataType'", e); + } + // deserialize UpdateTypedefDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateTypedefDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateTypedefDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateTypedefDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateTypedefDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateTypedefDataType'", e); + } + // deserialize UpdatePointerDataType + try { + // validate the JSON object to see if any exception is thrown + UpdatePointerDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdatePointerDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdatePointerDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdatePointerDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdatePointerDataType'", e); + } + // deserialize UpdateArrayDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateArrayDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateArrayDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateArrayDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateArrayDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateArrayDataType'", e); + } + // deserialize UpdateFunctionDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateFunctionDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateFunctionDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateFunctionDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateFunctionDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateFunctionDataType'", e); + } + // deserialize UpdateBitfieldDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateBitfieldDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateBitfieldDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateBitfieldDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateBitfieldDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateBitfieldDataType'", e); + } + // deserialize UpdateBaseDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateBaseDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateBaseDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateBaseDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateBaseDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateBaseDataType'", e); + } + // deserialize UpdateUnknownDataType + try { + // validate the JSON object to see if any exception is thrown + UpdateUnknownDataType.validateJsonElement(jsonElement); + actualAdapter = adapterUpdateUnknownDataType; + match++; + log.log(Level.FINER, "Input data matches schema 'UpdateUnknownDataType'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateUnknownDataType failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'UpdateUnknownDataType'", e); + } + + if (match == 1) { + UpdateDataTypeEntry ret = new UpdateDataTypeEntry(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for UpdateDataTypeEntry: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); + + public UpdateDataTypeEntry() { + super("oneOf", Boolean.FALSE); + } + + public UpdateDataTypeEntry(Object o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("UpdateStructDataType", UpdateStructDataType.class); + schemas.put("UpdateUnionDataType", UpdateUnionDataType.class); + schemas.put("UpdateEnumDataType", UpdateEnumDataType.class); + schemas.put("UpdateTypedefDataType", UpdateTypedefDataType.class); + schemas.put("UpdatePointerDataType", UpdatePointerDataType.class); + schemas.put("UpdateArrayDataType", UpdateArrayDataType.class); + schemas.put("UpdateFunctionDataType", UpdateFunctionDataType.class); + schemas.put("UpdateBitfieldDataType", UpdateBitfieldDataType.class); + schemas.put("UpdateBaseDataType", UpdateBaseDataType.class); + schemas.put("UpdateUnknownDataType", UpdateUnknownDataType.class); + } + + @Override + public Map> getSchemas() { + return UpdateDataTypeEntry.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * UpdateArrayDataType, UpdateBaseDataType, UpdateBitfieldDataType, UpdateEnumDataType, UpdateFunctionDataType, UpdatePointerDataType, UpdateStructDataType, UpdateTypedefDataType, UpdateUnionDataType, UpdateUnknownDataType + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof UpdateStructDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateUnionDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateEnumDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateTypedefDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdatePointerDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateArrayDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateFunctionDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateBitfieldDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateBaseDataType) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof UpdateUnknownDataType) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be UpdateArrayDataType, UpdateBaseDataType, UpdateBitfieldDataType, UpdateEnumDataType, UpdateFunctionDataType, UpdatePointerDataType, UpdateStructDataType, UpdateTypedefDataType, UpdateUnionDataType, UpdateUnknownDataType"); + } + + /** + * Get the actual instance, which can be the following: + * UpdateArrayDataType, UpdateBaseDataType, UpdateBitfieldDataType, UpdateEnumDataType, UpdateFunctionDataType, UpdatePointerDataType, UpdateStructDataType, UpdateTypedefDataType, UpdateUnionDataType, UpdateUnknownDataType + * + * @return The actual instance (UpdateArrayDataType, UpdateBaseDataType, UpdateBitfieldDataType, UpdateEnumDataType, UpdateFunctionDataType, UpdatePointerDataType, UpdateStructDataType, UpdateTypedefDataType, UpdateUnionDataType, UpdateUnknownDataType) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateStructDataType`. If the actual instance is not `UpdateStructDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateStructDataType` + * @throws ClassCastException if the instance is not `UpdateStructDataType` + */ + @SuppressWarnings("unchecked") + public UpdateStructDataType getUpdateStructDataType() throws ClassCastException { + return (UpdateStructDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateUnionDataType`. If the actual instance is not `UpdateUnionDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateUnionDataType` + * @throws ClassCastException if the instance is not `UpdateUnionDataType` + */ + @SuppressWarnings("unchecked") + public UpdateUnionDataType getUpdateUnionDataType() throws ClassCastException { + return (UpdateUnionDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateEnumDataType`. If the actual instance is not `UpdateEnumDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateEnumDataType` + * @throws ClassCastException if the instance is not `UpdateEnumDataType` + */ + @SuppressWarnings("unchecked") + public UpdateEnumDataType getUpdateEnumDataType() throws ClassCastException { + return (UpdateEnumDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateTypedefDataType`. If the actual instance is not `UpdateTypedefDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateTypedefDataType` + * @throws ClassCastException if the instance is not `UpdateTypedefDataType` + */ + @SuppressWarnings("unchecked") + public UpdateTypedefDataType getUpdateTypedefDataType() throws ClassCastException { + return (UpdateTypedefDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdatePointerDataType`. If the actual instance is not `UpdatePointerDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdatePointerDataType` + * @throws ClassCastException if the instance is not `UpdatePointerDataType` + */ + @SuppressWarnings("unchecked") + public UpdatePointerDataType getUpdatePointerDataType() throws ClassCastException { + return (UpdatePointerDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateArrayDataType`. If the actual instance is not `UpdateArrayDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateArrayDataType` + * @throws ClassCastException if the instance is not `UpdateArrayDataType` + */ + @SuppressWarnings("unchecked") + public UpdateArrayDataType getUpdateArrayDataType() throws ClassCastException { + return (UpdateArrayDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateFunctionDataType`. If the actual instance is not `UpdateFunctionDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateFunctionDataType` + * @throws ClassCastException if the instance is not `UpdateFunctionDataType` + */ + @SuppressWarnings("unchecked") + public UpdateFunctionDataType getUpdateFunctionDataType() throws ClassCastException { + return (UpdateFunctionDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateBitfieldDataType`. If the actual instance is not `UpdateBitfieldDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateBitfieldDataType` + * @throws ClassCastException if the instance is not `UpdateBitfieldDataType` + */ + @SuppressWarnings("unchecked") + public UpdateBitfieldDataType getUpdateBitfieldDataType() throws ClassCastException { + return (UpdateBitfieldDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateBaseDataType`. If the actual instance is not `UpdateBaseDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateBaseDataType` + * @throws ClassCastException if the instance is not `UpdateBaseDataType` + */ + @SuppressWarnings("unchecked") + public UpdateBaseDataType getUpdateBaseDataType() throws ClassCastException { + return (UpdateBaseDataType)super.getActualInstance(); + } + + /** + * Get the actual instance of `UpdateUnknownDataType`. If the actual instance is not `UpdateUnknownDataType`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `UpdateUnknownDataType` + * @throws ClassCastException if the instance is not `UpdateUnknownDataType` + */ + @SuppressWarnings("unchecked") + public UpdateUnknownDataType getUpdateUnknownDataType() throws ClassCastException { + return (UpdateUnknownDataType)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateDataTypeEntry + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with UpdateStructDataType + try { + UpdateStructDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateStructDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateUnionDataType + try { + UpdateUnionDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateUnionDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateEnumDataType + try { + UpdateEnumDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateEnumDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateTypedefDataType + try { + UpdateTypedefDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateTypedefDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdatePointerDataType + try { + UpdatePointerDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdatePointerDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateArrayDataType + try { + UpdateArrayDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateArrayDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateFunctionDataType + try { + UpdateFunctionDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateFunctionDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateBitfieldDataType + try { + UpdateBitfieldDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateBitfieldDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateBaseDataType + try { + UpdateBaseDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateBaseDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with UpdateUnknownDataType + try { + UpdateUnknownDataType.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format(java.util.Locale.ROOT, "Deserialization for UpdateUnknownDataType failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format(java.util.Locale.ROOT, "The JSON string is invalid for UpdateDataTypeEntry with oneOf schemas: UpdateArrayDataType, UpdateBaseDataType, UpdateBitfieldDataType, UpdateEnumDataType, UpdateFunctionDataType, UpdatePointerDataType, UpdateStructDataType, UpdateTypedefDataType, UpdateUnionDataType, UpdateUnknownDataType. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); + } + } + + /** + * Create an instance of UpdateDataTypeEntry given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateDataTypeEntry + * @throws IOException if the JSON string is invalid with respect to UpdateDataTypeEntry + */ + public static UpdateDataTypeEntry fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateDataTypeEntry.class); + } + + /** + * Convert an instance of UpdateDataTypeEntry to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateEnumDataType.java b/src/main/java/ai/reveng/model/UpdateEnumDataType.java new file mode 100644 index 00000000..37c6ddbd --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateEnumDataType.java @@ -0,0 +1,403 @@ +/* + * 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.EnumDefinition; +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; + +/** + * UpdateEnumDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateEnumDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private EnumDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + ENUM("ENUM"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateEnumDataType() { + } + + public UpdateEnumDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateEnumDataType definition(@javax.annotation.Nonnull EnumDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public EnumDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull EnumDefinition definition) { + this.definition = definition; + } + + + public UpdateEnumDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateEnumDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateEnumDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateEnumDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateEnumDataType updateEnumDataType = (UpdateEnumDataType) o; + return Objects.equals(this.dataTypeId, updateEnumDataType.dataTypeId) && + Objects.equals(this.definition, updateEnumDataType.definition) && + Objects.equals(this.kind, updateEnumDataType.kind) && + Objects.equals(this.name, updateEnumDataType.name) && + Objects.equals(this.namespace, updateEnumDataType.namespace) && + Objects.equals(this.size, updateEnumDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateEnumDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "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 UpdateEnumDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateEnumDataType.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 UpdateEnumDataType is not found in the empty JSON string", UpdateEnumDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateEnumDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateEnumDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateEnumDataType.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(); + // validate the required field `definition` + EnumDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateEnumDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateEnumDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateEnumDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateEnumDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateEnumDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateEnumDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateEnumDataType + * @throws IOException if the JSON string is invalid with respect to UpdateEnumDataType + */ + public static UpdateEnumDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateEnumDataType.class); + } + + /** + * Convert an instance of UpdateEnumDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateFunctionDataType.java b/src/main/java/ai/reveng/model/UpdateFunctionDataType.java new file mode 100644 index 00000000..68e9b011 --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateFunctionDataType.java @@ -0,0 +1,403 @@ +/* + * 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.FunctionTypeDefinition; +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; + +/** + * UpdateFunctionDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateFunctionDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private FunctionTypeDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + FUNCTION_DEFINITION("FUNCTION_DEFINITION"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateFunctionDataType() { + } + + public UpdateFunctionDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateFunctionDataType definition(@javax.annotation.Nonnull FunctionTypeDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public FunctionTypeDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull FunctionTypeDefinition definition) { + this.definition = definition; + } + + + public UpdateFunctionDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateFunctionDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateFunctionDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateFunctionDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFunctionDataType updateFunctionDataType = (UpdateFunctionDataType) o; + return Objects.equals(this.dataTypeId, updateFunctionDataType.dataTypeId) && + Objects.equals(this.definition, updateFunctionDataType.definition) && + Objects.equals(this.kind, updateFunctionDataType.kind) && + Objects.equals(this.name, updateFunctionDataType.name) && + Objects.equals(this.namespace, updateFunctionDataType.namespace) && + Objects.equals(this.size, updateFunctionDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFunctionDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "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 UpdateFunctionDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFunctionDataType.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 UpdateFunctionDataType is not found in the empty JSON string", UpdateFunctionDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFunctionDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateFunctionDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFunctionDataType.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(); + // validate the required field `definition` + FunctionTypeDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFunctionDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFunctionDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateFunctionDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFunctionDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFunctionDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFunctionDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFunctionDataType + * @throws IOException if the JSON string is invalid with respect to UpdateFunctionDataType + */ + public static UpdateFunctionDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFunctionDataType.class); + } + + /** + * Convert an instance of UpdateFunctionDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateFunctionSignatureInputBody.java b/src/main/java/ai/reveng/model/UpdateFunctionSignatureInputBody.java new file mode 100644 index 00000000..acba993c --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateFunctionSignatureInputBody.java @@ -0,0 +1,282 @@ +/* + * 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.SignatureParameterInput; +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; + +/** + * UpdateFunctionSignatureInputBody + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateFunctionSignatureInputBody { + public static final String SERIALIZED_NAME_CALLING_CONVENTION = "calling_convention"; + @SerializedName(SERIALIZED_NAME_CALLING_CONVENTION) + @javax.annotation.Nullable + private String callingConvention; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters; + + public static final String SERIALIZED_NAME_RETURN_DATA_TYPE_ID = "return_data_type_id"; + @SerializedName(SERIALIZED_NAME_RETURN_DATA_TYPE_ID) + @javax.annotation.Nullable + private Long returnDataTypeId; + + public UpdateFunctionSignatureInputBody() { + } + + public UpdateFunctionSignatureInputBody callingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + return this; + } + + /** + * Calling convention. Omit when there is none to record. + * @return callingConvention + */ + @javax.annotation.Nullable + public String getCallingConvention() { + return callingConvention; + } + + public void setCallingConvention(@javax.annotation.Nullable String callingConvention) { + this.callingConvention = callingConvention; + } + + + public UpdateFunctionSignatureInputBody parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public UpdateFunctionSignatureInputBody addParametersItem(SignatureParameterInput parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Parameters in argument order. An empty list records a function that takes no arguments. + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public UpdateFunctionSignatureInputBody returnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + return this; + } + + /** + * Return type, which must belong to this analysis. Omit for an unresolved return type. + * minimum: 0 + * @return returnDataTypeId + */ + @javax.annotation.Nullable + public Long getReturnDataTypeId() { + return returnDataTypeId; + } + + public void setReturnDataTypeId(@javax.annotation.Nullable Long returnDataTypeId) { + this.returnDataTypeId = returnDataTypeId; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateFunctionSignatureInputBody updateFunctionSignatureInputBody = (UpdateFunctionSignatureInputBody) o; + return Objects.equals(this.callingConvention, updateFunctionSignatureInputBody.callingConvention) && + Objects.equals(this.parameters, updateFunctionSignatureInputBody.parameters) && + Objects.equals(this.returnDataTypeId, updateFunctionSignatureInputBody.returnDataTypeId); + } + + @Override + public int hashCode() { + return Objects.hash(callingConvention, parameters, returnDataTypeId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFunctionSignatureInputBody {\n"); + sb.append(" callingConvention: ").append(toIndentedString(callingConvention)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" returnDataTypeId: ").append(toIndentedString(returnDataTypeId)).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("calling_convention", "parameters", "return_data_type_id")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("parameters")); + } + + /** + * 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 UpdateFunctionSignatureInputBody + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFunctionSignatureInputBody.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 UpdateFunctionSignatureInputBody is not found in the empty JSON string", UpdateFunctionSignatureInputBody.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFunctionSignatureInputBody.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateFunctionSignatureInputBody` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFunctionSignatureInputBody.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("calling_convention") != null && !jsonObj.get("calling_convention").isJsonNull()) && !jsonObj.get("calling_convention").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `calling_convention` to be a primitive type in the JSON string but got `%s`", jsonObj.get("calling_convention").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + // validate the required field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + SignatureParameterInput.validateJsonElement(jsonArrayparameters.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFunctionSignatureInputBody.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFunctionSignatureInputBody' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateFunctionSignatureInputBody.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFunctionSignatureInputBody value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFunctionSignatureInputBody read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateFunctionSignatureInputBody given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFunctionSignatureInputBody + * @throws IOException if the JSON string is invalid with respect to UpdateFunctionSignatureInputBody + */ + public static UpdateFunctionSignatureInputBody fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFunctionSignatureInputBody.class); + } + + /** + * Convert an instance of UpdateFunctionSignatureInputBody to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdatePointerDataType.java b/src/main/java/ai/reveng/model/UpdatePointerDataType.java new file mode 100644 index 00000000..364f6523 --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdatePointerDataType.java @@ -0,0 +1,403 @@ +/* + * 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.PointerDefinition; +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; + +/** + * UpdatePointerDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdatePointerDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private PointerDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + POINTER("POINTER"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdatePointerDataType() { + } + + public UpdatePointerDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdatePointerDataType definition(@javax.annotation.Nonnull PointerDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public PointerDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull PointerDefinition definition) { + this.definition = definition; + } + + + public UpdatePointerDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdatePointerDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdatePointerDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdatePointerDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdatePointerDataType updatePointerDataType = (UpdatePointerDataType) o; + return Objects.equals(this.dataTypeId, updatePointerDataType.dataTypeId) && + Objects.equals(this.definition, updatePointerDataType.definition) && + Objects.equals(this.kind, updatePointerDataType.kind) && + Objects.equals(this.name, updatePointerDataType.name) && + Objects.equals(this.namespace, updatePointerDataType.namespace) && + Objects.equals(this.size, updatePointerDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdatePointerDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "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 UpdatePointerDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePointerDataType.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 UpdatePointerDataType is not found in the empty JSON string", UpdatePointerDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdatePointerDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdatePointerDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdatePointerDataType.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(); + // validate the required field `definition` + PointerDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePointerDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePointerDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePointerDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePointerDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdatePointerDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdatePointerDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePointerDataType + * @throws IOException if the JSON string is invalid with respect to UpdatePointerDataType + */ + public static UpdatePointerDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePointerDataType.class); + } + + /** + * Convert an instance of UpdatePointerDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateStructDataType.java b/src/main/java/ai/reveng/model/UpdateStructDataType.java new file mode 100644 index 00000000..1d71795f --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateStructDataType.java @@ -0,0 +1,403 @@ +/* + * 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.StructDefinition; +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; + +/** + * UpdateStructDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateStructDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private StructDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + STRUCT("STRUCT"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateStructDataType() { + } + + public UpdateStructDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateStructDataType definition(@javax.annotation.Nonnull StructDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public StructDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull StructDefinition definition) { + this.definition = definition; + } + + + public UpdateStructDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateStructDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateStructDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateStructDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateStructDataType updateStructDataType = (UpdateStructDataType) o; + return Objects.equals(this.dataTypeId, updateStructDataType.dataTypeId) && + Objects.equals(this.definition, updateStructDataType.definition) && + Objects.equals(this.kind, updateStructDataType.kind) && + Objects.equals(this.name, updateStructDataType.name) && + Objects.equals(this.namespace, updateStructDataType.namespace) && + Objects.equals(this.size, updateStructDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateStructDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "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 UpdateStructDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateStructDataType.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 UpdateStructDataType is not found in the empty JSON string", UpdateStructDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateStructDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateStructDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateStructDataType.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(); + // validate the required field `definition` + StructDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateStructDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateStructDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateStructDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateStructDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateStructDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateStructDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateStructDataType + * @throws IOException if the JSON string is invalid with respect to UpdateStructDataType + */ + public static UpdateStructDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateStructDataType.class); + } + + /** + * Convert an instance of UpdateStructDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateTypedefDataType.java b/src/main/java/ai/reveng/model/UpdateTypedefDataType.java new file mode 100644 index 00000000..e0223d21 --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateTypedefDataType.java @@ -0,0 +1,403 @@ +/* + * 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.TypedefDefinition; +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; + +/** + * UpdateTypedefDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateTypedefDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private TypedefDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + TYPEDEF("TYPEDEF"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateTypedefDataType() { + } + + public UpdateTypedefDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateTypedefDataType definition(@javax.annotation.Nonnull TypedefDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public TypedefDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull TypedefDefinition definition) { + this.definition = definition; + } + + + public UpdateTypedefDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateTypedefDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateTypedefDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateTypedefDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTypedefDataType updateTypedefDataType = (UpdateTypedefDataType) o; + return Objects.equals(this.dataTypeId, updateTypedefDataType.dataTypeId) && + Objects.equals(this.definition, updateTypedefDataType.definition) && + Objects.equals(this.kind, updateTypedefDataType.kind) && + Objects.equals(this.name, updateTypedefDataType.name) && + Objects.equals(this.namespace, updateTypedefDataType.namespace) && + Objects.equals(this.size, updateTypedefDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTypedefDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "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 UpdateTypedefDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTypedefDataType.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 UpdateTypedefDataType is not found in the empty JSON string", UpdateTypedefDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTypedefDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateTypedefDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTypedefDataType.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(); + // validate the required field `definition` + TypedefDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTypedefDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTypedefDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateTypedefDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTypedefDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTypedefDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTypedefDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTypedefDataType + * @throws IOException if the JSON string is invalid with respect to UpdateTypedefDataType + */ + public static UpdateTypedefDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTypedefDataType.class); + } + + /** + * Convert an instance of UpdateTypedefDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/UpdateUnionDataType.java b/src/main/java/ai/reveng/model/UpdateUnionDataType.java new file mode 100644 index 00000000..301935eb --- /dev/null +++ b/src/main/java/ai/reveng/model/UpdateUnionDataType.java @@ -0,0 +1,403 @@ +/* + * 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.UnionDefinition; +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; + +/** + * UpdateUnionDataType + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class UpdateUnionDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) + @javax.annotation.Nonnull + private Long dataTypeId; + + public static final String SERIALIZED_NAME_DEFINITION = "definition"; + @SerializedName(SERIALIZED_NAME_DEFINITION) + @javax.annotation.Nonnull + private UnionDefinition definition; + + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + UNION("UNION"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + @javax.annotation.Nonnull + private String name; + + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) + @javax.annotation.Nullable + private String namespace; + + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + @javax.annotation.Nullable + private Long size; + + public UpdateUnionDataType() { + } + + public UpdateUnionDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + return this; + } + + /** + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId + */ + @javax.annotation.Nonnull + public Long getDataTypeId() { + return dataTypeId; + } + + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; + } + + + public UpdateUnionDataType definition(@javax.annotation.Nonnull UnionDefinition definition) { + this.definition = definition; + return this; + } + + /** + * Get definition + * @return definition + */ + @javax.annotation.Nonnull + public UnionDefinition getDefinition() { + return definition; + } + + public void setDefinition(@javax.annotation.Nonnull UnionDefinition definition) { + this.definition = definition; + } + + + public UpdateUnionDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; + } + + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; + } + + + public UpdateUnionDataType name(@javax.annotation.Nonnull String name) { + this.name = name; + return this; + } + + /** + * Type name. Unique within the analysis for a given namespace and kind. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(@javax.annotation.Nonnull String name) { + this.name = name; + } + + + public UpdateUnionDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + return this; + } + + /** + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace + */ + @javax.annotation.Nullable + public String getNamespace() { + return namespace; + } + + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; + } + + + public UpdateUnionDataType size(@javax.annotation.Nullable Long size) { + this.size = size; + return this; + } + + /** + * Size in bytes. Omit when it is not known. + * minimum: 0 + * @return size + */ + @javax.annotation.Nullable + public Long getSize() { + return size; + } + + public void setSize(@javax.annotation.Nullable Long size) { + this.size = size; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateUnionDataType updateUnionDataType = (UpdateUnionDataType) o; + return Objects.equals(this.dataTypeId, updateUnionDataType.dataTypeId) && + Objects.equals(this.definition, updateUnionDataType.definition) && + Objects.equals(this.kind, updateUnionDataType.kind) && + Objects.equals(this.name, updateUnionDataType.name) && + Objects.equals(this.namespace, updateUnionDataType.namespace) && + Objects.equals(this.size, updateUnionDataType.size); + } + + @Override + public int hashCode() { + return Objects.hash(dataTypeId, definition, kind, name, namespace, size); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateUnionDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "name", "namespace", "size")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "definition", "kind", "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 UpdateUnionDataType + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUnionDataType.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 UpdateUnionDataType is not found in the empty JSON string", UpdateUnionDataType.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUnionDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateUnionDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateUnionDataType.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(); + // validate the required field `definition` + UnionDefinition.validateJsonElement(jsonObj.get("definition")); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); + } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUnionDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUnionDataType' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateUnionDataType.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUnionDataType value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUnionDataType read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUnionDataType given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUnionDataType + * @throws IOException if the JSON string is invalid with respect to UpdateUnionDataType + */ + public static UpdateUnionDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUnionDataType.class); + } + + /** + * Convert an instance of UpdateUnionDataType to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/ai/reveng/model/FunctionStackVariable.java b/src/main/java/ai/reveng/model/UpdateUnknownDataType.java similarity index 52% rename from src/main/java/ai/reveng/model/FunctionStackVariable.java rename to src/main/java/ai/reveng/model/UpdateUnknownDataType.java index b54a14aa..9e54690e 100644 --- a/src/main/java/ai/reveng/model/FunctionStackVariable.java +++ b/src/main/java/ai/reveng/model/UpdateUnknownDataType.java @@ -45,93 +45,136 @@ import ai.reveng.invoker.JSON; /** - * FunctionStackVariable + * UpdateUnknownDataType */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class FunctionStackVariable { - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) +public class UpdateUnknownDataType { + public static final String SERIALIZED_NAME_DATA_TYPE_ID = "data_type_id"; + @SerializedName(SERIALIZED_NAME_DATA_TYPE_ID) @javax.annotation.Nonnull - private Long addr; + private Long dataTypeId; - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + UNKNOWN("UNKNOWN"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KindEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + @javax.annotation.Nonnull + private KindEnum kind; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nonnull private String name; - public static final String SERIALIZED_NAME_OFFSET = "offset"; - @SerializedName(SERIALIZED_NAME_OFFSET) - @javax.annotation.Nonnull - private Long offset; - - public static final String SERIALIZED_NAME_SCOPE = "scope"; - @SerializedName(SERIALIZED_NAME_SCOPE) + public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; + @SerializedName(SERIALIZED_NAME_NAMESPACE) @javax.annotation.Nullable - private String scope; + private String namespace; public static final String SERIALIZED_NAME_SIZE = "size"; @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nonnull + @javax.annotation.Nullable private Long size; - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public FunctionStackVariable() { + public UpdateUnknownDataType() { } - public FunctionStackVariable addr(@javax.annotation.Nonnull Long addr) { - this.addr = addr; + public UpdateUnknownDataType dataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; return this; } /** - * Get addr - * @return addr + * The type to replace, as returned by the data types list for this analysis. + * minimum: 0 + * @return dataTypeId */ @javax.annotation.Nonnull - public Long getAddr() { - return addr; + public Long getDataTypeId() { + return dataTypeId; } - public void setAddr(@javax.annotation.Nonnull Long addr) { - this.addr = addr; + public void setDataTypeId(@javax.annotation.Nonnull Long dataTypeId) { + this.dataTypeId = dataTypeId; } - public FunctionStackVariable lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; + public UpdateUnknownDataType kind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; return this; } /** - * Get lastChange - * @return lastChange + * Get kind + * @return kind */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; + @javax.annotation.Nonnull + public KindEnum getKind() { + return kind; } - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; + public void setKind(@javax.annotation.Nonnull KindEnum kind) { + this.kind = kind; } - public FunctionStackVariable name(@javax.annotation.Nonnull String name) { + public UpdateUnknownDataType name(@javax.annotation.Nonnull String name) { this.name = name; return this; } /** - * Get name + * Type name. Unique within the analysis for a given namespace and kind. * @return name */ @javax.annotation.Nonnull @@ -144,82 +187,45 @@ public void setName(@javax.annotation.Nonnull String name) { } - public FunctionStackVariable offset(@javax.annotation.Nonnull Long offset) { - this.offset = offset; - return this; - } - - /** - * Get offset - * @return offset - */ - @javax.annotation.Nonnull - public Long getOffset() { - return offset; - } - - public void setOffset(@javax.annotation.Nonnull Long offset) { - this.offset = offset; - } - - - public FunctionStackVariable scope(@javax.annotation.Nullable String scope) { - this.scope = scope; + public UpdateUnknownDataType namespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; return this; } /** - * Get scope - * @return scope + * The scope qualifying the type name. Omit for a type of the binary's own. + * @return namespace */ @javax.annotation.Nullable - public String getScope() { - return scope; + public String getNamespace() { + return namespace; } - public void setScope(@javax.annotation.Nullable String scope) { - this.scope = scope; + public void setNamespace(@javax.annotation.Nullable String namespace) { + this.namespace = namespace; } - public FunctionStackVariable size(@javax.annotation.Nonnull Long size) { + public UpdateUnknownDataType size(@javax.annotation.Nullable Long size) { this.size = size; return this; } /** - * Get size + * Size in bytes. Omit when it is not known. + * minimum: 0 * @return size */ - @javax.annotation.Nonnull + @javax.annotation.Nullable public Long getSize() { return size; } - public void setSize(@javax.annotation.Nonnull Long size) { + public void setSize(@javax.annotation.Nullable Long size) { this.size = size; } - public FunctionStackVariable type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - @Override public boolean equals(Object o) { @@ -229,32 +235,28 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - FunctionStackVariable functionStackVariable = (FunctionStackVariable) o; - return Objects.equals(this.addr, functionStackVariable.addr) && - Objects.equals(this.lastChange, functionStackVariable.lastChange) && - Objects.equals(this.name, functionStackVariable.name) && - Objects.equals(this.offset, functionStackVariable.offset) && - Objects.equals(this.scope, functionStackVariable.scope) && - Objects.equals(this.size, functionStackVariable.size) && - Objects.equals(this.type, functionStackVariable.type); + UpdateUnknownDataType updateUnknownDataType = (UpdateUnknownDataType) o; + return Objects.equals(this.dataTypeId, updateUnknownDataType.dataTypeId) && + Objects.equals(this.kind, updateUnknownDataType.kind) && + Objects.equals(this.name, updateUnknownDataType.name) && + Objects.equals(this.namespace, updateUnknownDataType.namespace) && + Objects.equals(this.size, updateUnknownDataType.size); } @Override public int hashCode() { - return Objects.hash(addr, lastChange, name, offset, scope, size, type); + return Objects.hash(dataTypeId, kind, name, namespace, size); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class FunctionStackVariable {\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); + sb.append("class UpdateUnknownDataType {\n"); + sb.append(" dataTypeId: ").append(toIndentedString(dataTypeId)).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" namespace: ").append(toIndentedString(namespace)).append("\n"); sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append("}"); return sb.toString(); } @@ -273,51 +275,50 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("addr", "last_change", "name", "offset", "scope", "size", "type")); + openapiFields = new HashSet(Arrays.asList("data_type_id", "kind", "name", "namespace", "size")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("addr", "name", "offset", "size", "type")); + openapiRequiredFields = new HashSet(Arrays.asList("data_type_id", "kind", "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 FunctionStackVariable + * @throws IOException if the JSON Element is invalid with respect to UpdateUnknownDataType */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!FunctionStackVariable.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 FunctionStackVariable is not found in the empty JSON string", FunctionStackVariable.openapiRequiredFields.toString())); + if (!UpdateUnknownDataType.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 UpdateUnknownDataType is not found in the empty JSON string", UpdateUnknownDataType.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!FunctionStackVariable.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `FunctionStackVariable` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!UpdateUnknownDataType.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The field `%s` in the JSON string is not defined in the `UpdateUnknownDataType` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FunctionStackVariable.openapiRequiredFields) { + for (String requiredField : UpdateUnknownDataType.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); + if (!jsonObj.get("kind").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `kind` to be a primitive type in the JSON string but got `%s`", jsonObj.get("kind").toString())); } + // validate the required field `kind` + KindEnum.validateJsonElement(jsonObj.get("kind")); if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } - if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + if ((jsonObj.get("namespace") != null && !jsonObj.get("namespace").isJsonNull()) && !jsonObj.get("namespace").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `namespace` to be a primitive type in the JSON string but got `%s`", jsonObj.get("namespace").toString())); } } @@ -325,22 +326,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!FunctionStackVariable.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FunctionStackVariable' and its subtypes + if (!UpdateUnknownDataType.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUnknownDataType' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(FunctionStackVariable.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateUnknownDataType.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, FunctionStackVariable value) throws IOException { + public void write(JsonWriter out, UpdateUnknownDataType value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public FunctionStackVariable read(JsonReader in) throws IOException { + public UpdateUnknownDataType read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -351,18 +352,18 @@ public FunctionStackVariable read(JsonReader in) throws IOException { } /** - * Create an instance of FunctionStackVariable given an JSON string + * Create an instance of UpdateUnknownDataType given an JSON string * * @param jsonString JSON string - * @return An instance of FunctionStackVariable - * @throws IOException if the JSON string is invalid with respect to FunctionStackVariable + * @return An instance of UpdateUnknownDataType + * @throws IOException if the JSON string is invalid with respect to UpdateUnknownDataType */ - public static FunctionStackVariable fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FunctionStackVariable.class); + public static UpdateUnknownDataType fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUnknownDataType.class); } /** - * Convert an instance of FunctionStackVariable to an JSON string + * Convert an instance of UpdateUnknownDataType to an JSON string * * @return JSON string */ diff --git a/src/main/java/ai/reveng/model/UpsertOverridesData.java b/src/main/java/ai/reveng/model/UpsertOverridesData.java index 23d90cbb..4b579ac4 100644 --- a/src/main/java/ai/reveng/model/UpsertOverridesData.java +++ b/src/main/java/ai/reveng/model/UpsertOverridesData.java @@ -13,6 +13,7 @@ package ai.reveng.model; import java.util.Objects; +import ai.reveng.model.Token; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -51,38 +52,38 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class UpsertOverridesData { - public static final String SERIALIZED_NAME_USER_OVERRIDE_MAPPINGS = "user_override_mappings"; - @SerializedName(SERIALIZED_NAME_USER_OVERRIDE_MAPPINGS) + public static final String SERIALIZED_NAME_PLACEHOLDER_TO_USER_OVERRIDE = "placeholder_to_user_override"; + @SerializedName(SERIALIZED_NAME_PLACEHOLDER_TO_USER_OVERRIDE) @javax.annotation.Nonnull - private Map userOverrideMappings = new HashMap<>(); + private Map placeholderToUserOverride = new HashMap<>(); public UpsertOverridesData() { } - public UpsertOverridesData userOverrideMappings(@javax.annotation.Nonnull Map userOverrideMappings) { - this.userOverrideMappings = userOverrideMappings; + public UpsertOverridesData placeholderToUserOverride(@javax.annotation.Nonnull Map placeholderToUserOverride) { + this.placeholderToUserOverride = placeholderToUserOverride; return this; } - public UpsertOverridesData putUserOverrideMappingsItem(String key, String userOverrideMappingsItem) { - if (this.userOverrideMappings == null) { - this.userOverrideMappings = new HashMap<>(); + public UpsertOverridesData putPlaceholderToUserOverrideItem(String key, Token placeholderToUserOverrideItem) { + if (this.placeholderToUserOverride == null) { + this.placeholderToUserOverride = new HashMap<>(); } - this.userOverrideMappings.put(key, userOverrideMappingsItem); + this.placeholderToUserOverride.put(key, placeholderToUserOverrideItem); return this; } /** - * Merged override mappings after applying changes - * @return userOverrideMappings + * Every override on the function after applying this request, keyed by placeholder token. + * @return placeholderToUserOverride */ @javax.annotation.Nonnull - public Map getUserOverrideMappings() { - return userOverrideMappings; + public Map getPlaceholderToUserOverride() { + return placeholderToUserOverride; } - public void setUserOverrideMappings(@javax.annotation.Nonnull Map userOverrideMappings) { - this.userOverrideMappings = userOverrideMappings; + public void setPlaceholderToUserOverride(@javax.annotation.Nonnull Map placeholderToUserOverride) { + this.placeholderToUserOverride = placeholderToUserOverride; } @@ -96,19 +97,19 @@ public boolean equals(Object o) { return false; } UpsertOverridesData upsertOverridesData = (UpsertOverridesData) o; - return Objects.equals(this.userOverrideMappings, upsertOverridesData.userOverrideMappings); + return Objects.equals(this.placeholderToUserOverride, upsertOverridesData.placeholderToUserOverride); } @Override public int hashCode() { - return Objects.hash(userOverrideMappings); + return Objects.hash(placeholderToUserOverride); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class UpsertOverridesData {\n"); - sb.append(" userOverrideMappings: ").append(toIndentedString(userOverrideMappings)).append("\n"); + sb.append(" placeholderToUserOverride: ").append(toIndentedString(placeholderToUserOverride)).append("\n"); sb.append("}"); return sb.toString(); } @@ -127,10 +128,10 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("user_override_mappings")); + openapiFields = new HashSet(Arrays.asList("placeholder_to_user_override")); // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("user_override_mappings")); + openapiRequiredFields = new HashSet(Arrays.asList("placeholder_to_user_override")); } /** diff --git a/src/main/java/ai/reveng/model/UpsertOverridesInputBody.java b/src/main/java/ai/reveng/model/UpsertOverridesInputBody.java index 4f963dca..c6459fd2 100644 --- a/src/main/java/ai/reveng/model/UpsertOverridesInputBody.java +++ b/src/main/java/ai/reveng/model/UpsertOverridesInputBody.java @@ -13,6 +13,7 @@ package ai.reveng.model; import java.util.Objects; +import ai.reveng.model.Token; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -54,17 +55,17 @@ public class UpsertOverridesInputBody { public static final String SERIALIZED_NAME_OVERRIDES = "overrides"; @SerializedName(SERIALIZED_NAME_OVERRIDES) @javax.annotation.Nonnull - private Map overrides = new HashMap<>(); + private Map overrides = new HashMap<>(); public UpsertOverridesInputBody() { } - public UpsertOverridesInputBody overrides(@javax.annotation.Nonnull Map overrides) { + public UpsertOverridesInputBody overrides(@javax.annotation.Nonnull Map overrides) { this.overrides = overrides; return this; } - public UpsertOverridesInputBody putOverridesItem(String key, String overridesItem) { + public UpsertOverridesInputBody putOverridesItem(String key, Token overridesItem) { if (this.overrides == null) { this.overrides = new HashMap<>(); } @@ -73,15 +74,15 @@ public UpsertOverridesInputBody putOverridesItem(String key, String overridesIte } /** - * Token to name mappings. Empty string removes the override. + * Overrides keyed by placeholder token. An entry whose value is an empty string removes that override. * @return overrides */ @javax.annotation.Nonnull - public Map getOverrides() { + public Map getOverrides() { return overrides; } - public void setOverrides(@javax.annotation.Nonnull Map overrides) { + public void setOverrides(@javax.annotation.Nonnull Map overrides) { this.overrides = overrides; } diff --git a/src/main/java/ai/reveng/model/V2FunctionHeader.java b/src/main/java/ai/reveng/model/V2FunctionHeader.java deleted file mode 100644 index 119e9121..00000000 --- a/src/main/java/ai/reveng/model/V2FunctionHeader.java +++ /dev/null @@ -1,422 +0,0 @@ -/* - * 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.Argument; -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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * V2FunctionHeader - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class V2FunctionHeader { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nonnull - private Integer addr; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_ARGS = "args"; - @SerializedName(SERIALIZED_NAME_ARGS) - @javax.annotation.Nonnull - private Map args = new HashMap<>(); - - public V2FunctionHeader() { - } - - public V2FunctionHeader lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this function header - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public V2FunctionHeader name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the function - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public V2FunctionHeader addr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; - return this; - } - - /** - * Memory address of the function - * @return addr - */ - @javax.annotation.Nonnull - public Integer getAddr() { - return addr; - } - - public void setAddr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; - } - - - public V2FunctionHeader type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Return type of the function - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public V2FunctionHeader args(@javax.annotation.Nonnull Map args) { - this.args = args; - return this; - } - - public V2FunctionHeader putArgsItem(String key, Argument argsItem) { - if (this.args == null) { - this.args = new HashMap<>(); - } - this.args.put(key, argsItem); - return this; - } - - /** - * Dictionary of function arguments - * @return args - */ - @javax.annotation.Nonnull - public Map getArgs() { - return args; - } - - public void setArgs(@javax.annotation.Nonnull Map args) { - this.args = args; - } - - /** - * 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 V2FunctionHeader instance itself - */ - public V2FunctionHeader 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; - } - V2FunctionHeader v2FunctionHeader = (V2FunctionHeader) o; - return Objects.equals(this.lastChange, v2FunctionHeader.lastChange) && - Objects.equals(this.name, v2FunctionHeader.name) && - Objects.equals(this.addr, v2FunctionHeader.addr) && - Objects.equals(this.type, v2FunctionHeader.type) && - Objects.equals(this.args, v2FunctionHeader.args)&& - Objects.equals(this.additionalProperties, v2FunctionHeader.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, name, addr, type, args, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V2FunctionHeader {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" args: ").append(toIndentedString(args)).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("last_change", "name", "addr", "type", "args")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "addr", "type", "args")); - } - - /** - * 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 V2FunctionHeader - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V2FunctionHeader.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 V2FunctionHeader is not found in the empty JSON string", V2FunctionHeader.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : V2FunctionHeader.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - 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())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V2FunctionHeader.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V2FunctionHeader' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V2FunctionHeader.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V2FunctionHeader 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 V2FunctionHeader read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - V2FunctionHeader 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 V2FunctionHeader given an JSON string - * - * @param jsonString JSON string - * @return An instance of V2FunctionHeader - * @throws IOException if the JSON string is invalid with respect to V2FunctionHeader - */ - public static V2FunctionHeader fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V2FunctionHeader.class); - } - - /** - * Convert an instance of V2FunctionHeader to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/V2FunctionInfo.java b/src/main/java/ai/reveng/model/V2FunctionInfo.java deleted file mode 100644 index f9637f3b..00000000 --- a/src/main/java/ai/reveng/model/V2FunctionInfo.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * 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.FuncDepsInner; -import ai.reveng.model.V2FunctionType; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * V2FunctionInfo - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class V2FunctionInfo { - public static final String SERIALIZED_NAME_FUNC_TYPES = "func_types"; - @SerializedName(SERIALIZED_NAME_FUNC_TYPES) - @javax.annotation.Nullable - private V2FunctionType funcTypes; - - public static final String SERIALIZED_NAME_FUNC_DEPS = "func_deps"; - @SerializedName(SERIALIZED_NAME_FUNC_DEPS) - @javax.annotation.Nonnull - private List funcDeps = new ArrayList<>(); - - public V2FunctionInfo() { - } - - public V2FunctionInfo funcTypes(@javax.annotation.Nullable V2FunctionType funcTypes) { - this.funcTypes = funcTypes; - return this; - } - - /** - * Function type information - * @return funcTypes - */ - @javax.annotation.Nullable - public V2FunctionType getFuncTypes() { - return funcTypes; - } - - public void setFuncTypes(@javax.annotation.Nullable V2FunctionType funcTypes) { - this.funcTypes = funcTypes; - } - - - public V2FunctionInfo funcDeps(@javax.annotation.Nonnull List funcDeps) { - this.funcDeps = funcDeps; - return this; - } - - public V2FunctionInfo addFuncDepsItem(FuncDepsInner funcDepsItem) { - if (this.funcDeps == null) { - this.funcDeps = new ArrayList<>(); - } - this.funcDeps.add(funcDepsItem); - return this; - } - - /** - * List of function dependencies - * @return funcDeps - */ - @javax.annotation.Nonnull - public List getFuncDeps() { - return funcDeps; - } - - public void setFuncDeps(@javax.annotation.Nonnull List funcDeps) { - this.funcDeps = funcDeps; - } - - /** - * 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 V2FunctionInfo instance itself - */ - public V2FunctionInfo 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; - } - V2FunctionInfo v2FunctionInfo = (V2FunctionInfo) o; - return Objects.equals(this.funcTypes, v2FunctionInfo.funcTypes) && - Objects.equals(this.funcDeps, v2FunctionInfo.funcDeps)&& - Objects.equals(this.additionalProperties, v2FunctionInfo.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(funcTypes, funcDeps, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V2FunctionInfo {\n"); - sb.append(" funcTypes: ").append(toIndentedString(funcTypes)).append("\n"); - sb.append(" funcDeps: ").append(toIndentedString(funcDeps)).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("func_types", "func_deps")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("func_deps")); - } - - /** - * 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 V2FunctionInfo - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V2FunctionInfo.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 V2FunctionInfo is not found in the empty JSON string", V2FunctionInfo.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : V2FunctionInfo.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(); - // validate the optional field `func_types` - if (jsonObj.get("func_types") != null && !jsonObj.get("func_types").isJsonNull()) { - V2FunctionType.validateJsonElement(jsonObj.get("func_types")); - } - if (jsonObj.get("func_deps") != null) { - if (!jsonObj.get("func_deps").isJsonArray()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `func_deps` to be an array in the JSON string but got `%s`", jsonObj.get("func_deps").toString())); - } - JsonArray jsonArrayfuncDeps = jsonObj.getAsJsonArray("func_deps"); - // validate the required field `func_deps` (array) - for (int i = 0; i < jsonArrayfuncDeps.size(); i++) { - FuncDepsInner.validateJsonElement(jsonArrayfuncDeps.get(i)); - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V2FunctionInfo.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V2FunctionInfo' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V2FunctionInfo.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V2FunctionInfo 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 V2FunctionInfo read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - V2FunctionInfo 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 V2FunctionInfo given an JSON string - * - * @param jsonString JSON string - * @return An instance of V2FunctionInfo - * @throws IOException if the JSON string is invalid with respect to V2FunctionInfo - */ - public static V2FunctionInfo fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V2FunctionInfo.class); - } - - /** - * Convert an instance of V2FunctionInfo to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/src/main/java/ai/reveng/model/V2FunctionType.java b/src/main/java/ai/reveng/model/V2FunctionType.java deleted file mode 100644 index 38d6fe3c..00000000 --- a/src/main/java/ai/reveng/model/V2FunctionType.java +++ /dev/null @@ -1,506 +0,0 @@ -/* - * 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.StackVariable; -import ai.reveng.model.V2FunctionHeader; -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 org.openapitools.jackson.nullable.JsonNullable; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import ai.reveng.invoker.JSON; - -/** - * V2FunctionType - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") -public class V2FunctionType { - public static final String SERIALIZED_NAME_LAST_CHANGE = "last_change"; - @SerializedName(SERIALIZED_NAME_LAST_CHANGE) - @javax.annotation.Nullable - private String lastChange; - - public static final String SERIALIZED_NAME_ADDR = "addr"; - @SerializedName(SERIALIZED_NAME_ADDR) - @javax.annotation.Nonnull - private Integer addr; - - public static final String SERIALIZED_NAME_SIZE = "size"; - @SerializedName(SERIALIZED_NAME_SIZE) - @javax.annotation.Nonnull - private Integer size; - - public static final String SERIALIZED_NAME_HEADER = "header"; - @SerializedName(SERIALIZED_NAME_HEADER) - @javax.annotation.Nonnull - private V2FunctionHeader header; - - public static final String SERIALIZED_NAME_STACK_VARS = "stack_vars"; - @SerializedName(SERIALIZED_NAME_STACK_VARS) - @javax.annotation.Nullable - private Map stackVars; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nonnull - private String type; - - public static final String SERIALIZED_NAME_ARTIFACT_TYPE = "artifact_type"; - @SerializedName(SERIALIZED_NAME_ARTIFACT_TYPE) - @javax.annotation.Nullable - private String artifactType = "Function"; - - public V2FunctionType() { - } - - public V2FunctionType lastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - return this; - } - - /** - * Timestamp of the last change to this function type - * @return lastChange - */ - @javax.annotation.Nullable - public String getLastChange() { - return lastChange; - } - - public void setLastChange(@javax.annotation.Nullable String lastChange) { - this.lastChange = lastChange; - } - - - public V2FunctionType addr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; - return this; - } - - /** - * Memory address of the function - * @return addr - */ - @javax.annotation.Nonnull - public Integer getAddr() { - return addr; - } - - public void setAddr(@javax.annotation.Nonnull Integer addr) { - this.addr = addr; - } - - - public V2FunctionType size(@javax.annotation.Nonnull Integer size) { - this.size = size; - return this; - } - - /** - * Size of the function in bytes - * @return size - */ - @javax.annotation.Nonnull - public Integer getSize() { - return size; - } - - public void setSize(@javax.annotation.Nonnull Integer size) { - this.size = size; - } - - - public V2FunctionType header(@javax.annotation.Nonnull V2FunctionHeader header) { - this.header = header; - return this; - } - - /** - * Function header information - * @return header - */ - @javax.annotation.Nonnull - public V2FunctionHeader getHeader() { - return header; - } - - public void setHeader(@javax.annotation.Nonnull V2FunctionHeader header) { - this.header = header; - } - - - public V2FunctionType stackVars(@javax.annotation.Nullable Map stackVars) { - this.stackVars = stackVars; - return this; - } - - public V2FunctionType putStackVarsItem(String key, StackVariable stackVarsItem) { - if (this.stackVars == null) { - this.stackVars = new HashMap<>(); - } - this.stackVars.put(key, stackVarsItem); - return this; - } - - /** - * Dictionary of stack variables - * @return stackVars - */ - @javax.annotation.Nullable - public Map getStackVars() { - return stackVars; - } - - public void setStackVars(@javax.annotation.Nullable Map stackVars) { - this.stackVars = stackVars; - } - - - public V2FunctionType name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Name of the function - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public V2FunctionType type(@javax.annotation.Nonnull String type) { - this.type = type; - return this; - } - - /** - * Return type of the function - * @return type - */ - @javax.annotation.Nonnull - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nonnull String type) { - this.type = type; - } - - - public V2FunctionType artifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - return this; - } - - /** - * Type of artifact that the structure is associated with - * @return artifactType - */ - @javax.annotation.Nullable - public String getArtifactType() { - return artifactType; - } - - public void setArtifactType(@javax.annotation.Nullable String artifactType) { - this.artifactType = artifactType; - } - - /** - * 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 V2FunctionType instance itself - */ - public V2FunctionType 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; - } - V2FunctionType v2FunctionType = (V2FunctionType) o; - return Objects.equals(this.lastChange, v2FunctionType.lastChange) && - Objects.equals(this.addr, v2FunctionType.addr) && - Objects.equals(this.size, v2FunctionType.size) && - Objects.equals(this.header, v2FunctionType.header) && - Objects.equals(this.stackVars, v2FunctionType.stackVars) && - Objects.equals(this.name, v2FunctionType.name) && - Objects.equals(this.type, v2FunctionType.type) && - Objects.equals(this.artifactType, v2FunctionType.artifactType)&& - Objects.equals(this.additionalProperties, v2FunctionType.additionalProperties); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(lastChange, addr, size, header, stackVars, name, type, artifactType, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class V2FunctionType {\n"); - sb.append(" lastChange: ").append(toIndentedString(lastChange)).append("\n"); - sb.append(" addr: ").append(toIndentedString(addr)).append("\n"); - sb.append(" size: ").append(toIndentedString(size)).append("\n"); - sb.append(" header: ").append(toIndentedString(header)).append("\n"); - sb.append(" stackVars: ").append(toIndentedString(stackVars)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" artifactType: ").append(toIndentedString(artifactType)).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("last_change", "addr", "size", "header", "stack_vars", "name", "type", "artifact_type")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("addr", "size", "header", "name", "type")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to V2FunctionType - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!V2FunctionType.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 V2FunctionType is not found in the empty JSON string", V2FunctionType.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : V2FunctionType.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("last_change") != null && !jsonObj.get("last_change").isJsonNull()) && !jsonObj.get("last_change").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `last_change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("last_change").toString())); - } - // validate the required field `header` - V2FunctionHeader.validateJsonElement(jsonObj.get("header")); - 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())); - } - if (!jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if ((jsonObj.get("artifact_type") != null && !jsonObj.get("artifact_type").isJsonNull()) && !jsonObj.get("artifact_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `artifact_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("artifact_type").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!V2FunctionType.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'V2FunctionType' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(V2FunctionType.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, V2FunctionType 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 V2FunctionType read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - V2FunctionType 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 V2FunctionType given an JSON string - * - * @param jsonString JSON string - * @return An instance of V2FunctionType - * @throws IOException if the JSON string is invalid with respect to V2FunctionType - */ - public static V2FunctionType fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, V2FunctionType.class); - } - - /** - * Convert an instance of V2FunctionType to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} -