From 798aadb800eb1e457eab371ae167d4b7063dca85 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 18 Sep 2025 09:51:44 +0000 Subject: [PATCH] Update SDK to version v1.85.0 - Generated from OpenAPI spec version v1.85.0 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 5 +- docs/AnalysesCoreApi.md | 10 +- docs/AppApiRestV1AnnSchemaANNFunction.md | 37 ++ ...ppApiRestV2SimilaritySchemaANNFunction.md} | 16 +- docs/FunctionBatchAnn.md | 31 ++ docs/V1Api.md | 92 +++++ revengai/__init__.py | 12 +- revengai/api/__init__.py | 1 + revengai/api/analyses_core_api.py | 32 +- revengai/api/v1_api.py | 334 ++++++++++++++++++ revengai/api_client.py | 2 +- revengai/configuration.py | 4 +- revengai/models/__init__.py | 4 +- ...app_api_rest_v1_ann_schema_ann_function.py | 134 +++++++ ...rest_v2_similarity_schema_ann_function.py} | 8 +- revengai/models/function_batch_ann.py | 105 ++++++ ...app_api_rest_v1_ann_schema_ann_function.py | 73 ++++ ...rest_v2_similarity_schema_ann_function.py} | 22 +- test/test_function_batch_ann.py | 54 +++ test/test_v1_api.py | 37 ++ 21 files changed, 962 insertions(+), 53 deletions(-) create mode 100644 docs/AppApiRestV1AnnSchemaANNFunction.md rename docs/{ANNFunction.md => AppApiRestV2SimilaritySchemaANNFunction.md} (60%) create mode 100644 docs/FunctionBatchAnn.md create mode 100644 docs/V1Api.md create mode 100644 revengai/api/v1_api.py create mode 100644 revengai/models/app_api_rest_v1_ann_schema_ann_function.py rename revengai/models/{ann_function.py => app_api_rest_v2_similarity_schema_ann_function.py} (94%) create mode 100644 revengai/models/function_batch_ann.py create mode 100644 test/test_app_api_rest_v1_ann_schema_ann_function.py rename test/{test_ann_function.py => test_app_api_rest_v2_similarity_schema_ann_function.py} (59%) create mode 100644 test/test_function_batch_ann.py create mode 100644 test/test_v1_api.py diff --git a/.sdk-version b/.sdk-version index 1b4d851..6b8da40 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v1.84.0 +v1.85.0 diff --git a/README.md b/README.md index 866a5fe..b423aa2 100644 --- a/README.md +++ b/README.md @@ -155,11 +155,11 @@ Class | Method | HTTP request | Description *SearchApi* | [**search_collections**](docs/SearchApi.md#search_collections) | **GET** /v2/search/collections | Collections search *SearchApi* | [**search_functions**](docs/SearchApi.md#search_functions) | **GET** /v2/search/functions | Functions search *SearchApi* | [**search_tags**](docs/SearchApi.md#search_tags) | **GET** /v2/search/tags | Tags search +*V1Api* | [**batch_symbol_ann**](docs/V1Api.md#batch_symbol_ann) | **POST** /v1/ann/symbol/batch | Batch Symbol ANN using function IDs ## Documentation For Models - - [ANNFunction](docs/ANNFunction.md) - [Addr](docs/Addr.md) - [AiDecompilationRating](docs/AiDecompilationRating.md) - [AiUnstripRequest](docs/AiUnstripRequest.md) @@ -178,12 +178,14 @@ Class | Method | HTTP request | Description - [AnalysisUpdateRequest](docs/AnalysisUpdateRequest.md) - [AnalysisUpdateTagsRequest](docs/AnalysisUpdateTagsRequest.md) - [AnalysisUpdateTagsResponse](docs/AnalysisUpdateTagsResponse.md) + - [AppApiRestV1AnnSchemaANNFunction](docs/AppApiRestV1AnnSchemaANNFunction.md) - [AppApiRestV2AnalysesEnumsDynamicExecutionStatus](docs/AppApiRestV2AnalysesEnumsDynamicExecutionStatus.md) - [AppApiRestV2AnalysesEnumsOrderBy](docs/AppApiRestV2AnalysesEnumsOrderBy.md) - [AppApiRestV2AnalysesResponsesTagItem](docs/AppApiRestV2AnalysesResponsesTagItem.md) - [AppApiRestV2CollectionsEnumsOrderBy](docs/AppApiRestV2CollectionsEnumsOrderBy.md) - [AppApiRestV2FunctionsResponsesFunction](docs/AppApiRestV2FunctionsResponsesFunction.md) - [AppApiRestV2FunctionsTypesFunction](docs/AppApiRestV2FunctionsTypesFunction.md) + - [AppApiRestV2SimilaritySchemaANNFunction](docs/AppApiRestV2SimilaritySchemaANNFunction.md) - [AppServicesBinaryAnnSchemaTagItem](docs/AppServicesBinaryAnnSchemaTagItem.md) - [AppServicesDynamicExecutionSchemasDynamicExecutionStatus](docs/AppServicesDynamicExecutionSchemasDynamicExecutionStatus.md) - [Argument](docs/Argument.md) @@ -333,6 +335,7 @@ Class | Method | HTTP request | Description - [FileMetadata](docs/FileMetadata.md) - [Filters](docs/Filters.md) - [FunctionAnalysisThreatScoreData](docs/FunctionAnalysisThreatScoreData.md) + - [FunctionBatchAnn](docs/FunctionBatchAnn.md) - [FunctionBlockDestinationResponse](docs/FunctionBlockDestinationResponse.md) - [FunctionBlockResponse](docs/FunctionBlockResponse.md) - [FunctionBlocksResponse](docs/FunctionBlocksResponse.md) diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 3cdea58..0ec8793 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -191,7 +191,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **find_similar_functions_batch** -> BaseResponseNearestNeighborAnalysis find_similar_functions_batch(analysis_id, ann_function, authorization=authorization) +> BaseResponseNearestNeighborAnalysis find_similar_functions_batch(analysis_id, app_api_rest_v2_similarity_schema_ann_function, authorization=authorization) Batch Symbol ANN using Analysis ID @@ -203,7 +203,7 @@ Takes a analysis ID and returns the nearest functions within the database that m ```python import revengai -from revengai.models.ann_function import ANNFunction +from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction from revengai.models.base_response_nearest_neighbor_analysis import BaseResponseNearestNeighborAnalysis from revengai.rest import ApiException from pprint import pprint @@ -230,12 +230,12 @@ with revengai.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = revengai.AnalysesCoreApi(api_client) analysis_id = 56 # int | - ann_function = revengai.ANNFunction() # ANNFunction | + app_api_rest_v2_similarity_schema_ann_function = revengai.AppApiRestV2SimilaritySchemaANNFunction() # AppApiRestV2SimilaritySchemaANNFunction | authorization = 'authorization_example' # str | API Key bearer token (optional) try: # Batch Symbol ANN using Analysis ID - api_response = api_instance.find_similar_functions_batch(analysis_id, ann_function, authorization=authorization) + api_response = api_instance.find_similar_functions_batch(analysis_id, app_api_rest_v2_similarity_schema_ann_function, authorization=authorization) print("The response of AnalysesCoreApi->find_similar_functions_batch:\n") pprint(api_response) except Exception as e: @@ -250,7 +250,7 @@ with revengai.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **analysis_id** | **int**| | - **ann_function** | [**ANNFunction**](ANNFunction.md)| | + **app_api_rest_v2_similarity_schema_ann_function** | [**AppApiRestV2SimilaritySchemaANNFunction**](AppApiRestV2SimilaritySchemaANNFunction.md)| | **authorization** | **str**| API Key bearer token | [optional] ### Return type diff --git a/docs/AppApiRestV1AnnSchemaANNFunction.md b/docs/AppApiRestV1AnnSchemaANNFunction.md new file mode 100644 index 0000000..230f341 --- /dev/null +++ b/docs/AppApiRestV1AnnSchemaANNFunction.md @@ -0,0 +1,37 @@ +# AppApiRestV1AnnSchemaANNFunction + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**result_per_function** | **int** | | [optional] +**distance** | **float** | | [optional] +**function_id_list** | **List[Optional[int]]** | List of function ids to compare | +**speculative_function_ids** | **List[object]** | | [optional] +**collection** | **List[Optional[str]]** | Perform a search on functions within a list of collections | [optional] [default to []] +**collection_search_list** | **List[Optional[int]]** | Perform a search on functions within a list of collections | [optional] [default to []] +**debug_mode** | **bool** | | [optional] +**debug_types** | **List[str]** | If limiting results to functions with debug names, which type of debug names to include? | [optional] [default to [SYSTEM]] +**binaries_search_list** | **List[Optional[int]]** | Perform a search on functions within a list of analyses | [optional] [default to []] + +## Example + +```python +from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction + +# TODO update the JSON string below +json = "{}" +# create an instance of AppApiRestV1AnnSchemaANNFunction from a JSON string +app_api_rest_v1_ann_schema_ann_function_instance = AppApiRestV1AnnSchemaANNFunction.from_json(json) +# print the JSON string representation of the object +print(AppApiRestV1AnnSchemaANNFunction.to_json()) + +# convert the object into a dict +app_api_rest_v1_ann_schema_ann_function_dict = app_api_rest_v1_ann_schema_ann_function_instance.to_dict() +# create an instance of AppApiRestV1AnnSchemaANNFunction from a dict +app_api_rest_v1_ann_schema_ann_function_from_dict = AppApiRestV1AnnSchemaANNFunction.from_dict(app_api_rest_v1_ann_schema_ann_function_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ANNFunction.md b/docs/AppApiRestV2SimilaritySchemaANNFunction.md similarity index 60% rename from docs/ANNFunction.md rename to docs/AppApiRestV2SimilaritySchemaANNFunction.md index e58dac4..ef1490f 100644 --- a/docs/ANNFunction.md +++ b/docs/AppApiRestV2SimilaritySchemaANNFunction.md @@ -1,4 +1,4 @@ -# ANNFunction +# AppApiRestV2SimilaritySchemaANNFunction ## Properties @@ -16,19 +16,19 @@ Name | Type | Description | Notes ## Example ```python -from revengai.models.ann_function import ANNFunction +from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction # TODO update the JSON string below json = "{}" -# create an instance of ANNFunction from a JSON string -ann_function_instance = ANNFunction.from_json(json) +# create an instance of AppApiRestV2SimilaritySchemaANNFunction from a JSON string +app_api_rest_v2_similarity_schema_ann_function_instance = AppApiRestV2SimilaritySchemaANNFunction.from_json(json) # print the JSON string representation of the object -print(ANNFunction.to_json()) +print(AppApiRestV2SimilaritySchemaANNFunction.to_json()) # convert the object into a dict -ann_function_dict = ann_function_instance.to_dict() -# create an instance of ANNFunction from a dict -ann_function_from_dict = ANNFunction.from_dict(ann_function_dict) +app_api_rest_v2_similarity_schema_ann_function_dict = app_api_rest_v2_similarity_schema_ann_function_instance.to_dict() +# create an instance of AppApiRestV2SimilaritySchemaANNFunction from a dict +app_api_rest_v2_similarity_schema_ann_function_from_dict = AppApiRestV2SimilaritySchemaANNFunction.from_dict(app_api_rest_v2_similarity_schema_ann_function_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/FunctionBatchAnn.md b/docs/FunctionBatchAnn.md new file mode 100644 index 0000000..3be2868 --- /dev/null +++ b/docs/FunctionBatchAnn.md @@ -0,0 +1,31 @@ +# FunctionBatchAnn + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **object** | | [optional] +**settings** | **object** | | +**function_matches** | **object** | | + +## Example + +```python +from revengai.models.function_batch_ann import FunctionBatchAnn + +# TODO update the JSON string below +json = "{}" +# create an instance of FunctionBatchAnn from a JSON string +function_batch_ann_instance = FunctionBatchAnn.from_json(json) +# print the JSON string representation of the object +print(FunctionBatchAnn.to_json()) + +# convert the object into a dict +function_batch_ann_dict = function_batch_ann_instance.to_dict() +# create an instance of FunctionBatchAnn from a dict +function_batch_ann_from_dict = FunctionBatchAnn.from_dict(function_batch_ann_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/V1Api.md b/docs/V1Api.md new file mode 100644 index 0000000..b47b3f5 --- /dev/null +++ b/docs/V1Api.md @@ -0,0 +1,92 @@ +# revengai.V1Api + +All URIs are relative to *https://api.reveng.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**batch_symbol_ann**](V1Api.md#batch_symbol_ann) | **POST** /v1/ann/symbol/batch | Batch Symbol ANN using function IDs + + +# **batch_symbol_ann** +> FunctionBatchAnn batch_symbol_ann(app_api_rest_v1_ann_schema_ann_function, authorization=authorization) + +Batch Symbol ANN using function IDs + +Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction +from revengai.models.function_batch_ann import FunctionBatchAnn +from revengai.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.reveng.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = revengai.Configuration( + host = "https://api.reveng.ai" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: APIKey +configuration.api_key['APIKey'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['APIKey'] = 'Bearer' + +# Enter a context with an instance of the API client +with revengai.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = revengai.V1Api(api_client) + app_api_rest_v1_ann_schema_ann_function = revengai.AppApiRestV1AnnSchemaANNFunction() # AppApiRestV1AnnSchemaANNFunction | + authorization = 'authorization_example' # str | API Key bearer token (optional) + + try: + # Batch Symbol ANN using function IDs + api_response = api_instance.batch_symbol_ann(app_api_rest_v1_ann_schema_ann_function, authorization=authorization) + print("The response of V1Api->batch_symbol_ann:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling V1Api->batch_symbol_ann: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_api_rest_v1_ann_schema_ann_function** | [**AppApiRestV1AnnSchemaANNFunction**](AppApiRestV1AnnSchemaANNFunction.md)| | + **authorization** | **str**| API Key bearer token | [optional] + +### Return type + +[**FunctionBatchAnn**](FunctionBatchAnn.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful Response | - | +**422** | Invalid request parameters | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/revengai/__init__.py b/revengai/__init__.py index 6b49fdb..1b90e16 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v1.84.0" +__version__ = "v1.85.0" # Define package exports __all__ = [ @@ -37,6 +37,7 @@ "FunctionsThreatScoreApi", "ModelsApi", "SearchApi", + "V1Api", "ApiResponse", "ApiClient", "Configuration", @@ -46,7 +47,6 @@ "ApiKeyError", "ApiAttributeError", "ApiException", - "ANNFunction", "Addr", "AiDecompilationRating", "AiUnstripRequest", @@ -65,12 +65,14 @@ "AnalysisUpdateRequest", "AnalysisUpdateTagsRequest", "AnalysisUpdateTagsResponse", + "AppApiRestV1AnnSchemaANNFunction", "AppApiRestV2AnalysesEnumsDynamicExecutionStatus", "AppApiRestV2AnalysesEnumsOrderBy", "AppApiRestV2AnalysesResponsesTagItem", "AppApiRestV2CollectionsEnumsOrderBy", "AppApiRestV2FunctionsResponsesFunction", "AppApiRestV2FunctionsTypesFunction", + "AppApiRestV2SimilaritySchemaANNFunction", "AppServicesBinaryAnnSchemaTagItem", "AppServicesDynamicExecutionSchemasDynamicExecutionStatus", "Argument", @@ -220,6 +222,7 @@ "FileMetadata", "Filters", "FunctionAnalysisThreatScoreData", + "FunctionBatchAnn", "FunctionBlockDestinationResponse", "FunctionBlockResponse", "FunctionBlocksResponse", @@ -373,6 +376,7 @@ from revengai.api.functions_threat_score_api import FunctionsThreatScoreApi as FunctionsThreatScoreApi from revengai.api.models_api import ModelsApi as ModelsApi from revengai.api.search_api import SearchApi as SearchApi +from revengai.api.v1_api import V1Api as V1Api # import ApiClient from revengai.api_response import ApiResponse as ApiResponse @@ -386,7 +390,6 @@ from revengai.exceptions import ApiException as ApiException # import models into sdk package -from revengai.models.ann_function import ANNFunction as ANNFunction from revengai.models.addr import Addr as Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating as AiDecompilationRating from revengai.models.ai_unstrip_request import AiUnstripRequest as AiUnstripRequest @@ -405,12 +408,14 @@ from revengai.models.analysis_update_request import AnalysisUpdateRequest as AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest as AnalysisUpdateTagsRequest from revengai.models.analysis_update_tags_response import AnalysisUpdateTagsResponse as AnalysisUpdateTagsResponse +from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction as AppApiRestV1AnnSchemaANNFunction from revengai.models.app_api_rest_v2_analyses_enums_dynamic_execution_status import AppApiRestV2AnalysesEnumsDynamicExecutionStatus as AppApiRestV2AnalysesEnumsDynamicExecutionStatus from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy as AppApiRestV2AnalysesEnumsOrderBy from revengai.models.app_api_rest_v2_analyses_responses_tag_item import AppApiRestV2AnalysesResponsesTagItem as AppApiRestV2AnalysesResponsesTagItem from revengai.models.app_api_rest_v2_collections_enums_order_by import AppApiRestV2CollectionsEnumsOrderBy as AppApiRestV2CollectionsEnumsOrderBy from revengai.models.app_api_rest_v2_functions_responses_function import AppApiRestV2FunctionsResponsesFunction as AppApiRestV2FunctionsResponsesFunction from revengai.models.app_api_rest_v2_functions_types_function import AppApiRestV2FunctionsTypesFunction as AppApiRestV2FunctionsTypesFunction +from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction as AppApiRestV2SimilaritySchemaANNFunction from revengai.models.app_services_binary_ann_schema_tag_item import AppServicesBinaryAnnSchemaTagItem as AppServicesBinaryAnnSchemaTagItem from revengai.models.app_services_dynamic_execution_schemas_dynamic_execution_status import AppServicesDynamicExecutionSchemasDynamicExecutionStatus as AppServicesDynamicExecutionSchemasDynamicExecutionStatus from revengai.models.argument import Argument as Argument @@ -560,6 +565,7 @@ from revengai.models.file_metadata import FileMetadata as FileMetadata from revengai.models.filters import Filters as Filters from revengai.models.function_analysis_threat_score_data import FunctionAnalysisThreatScoreData as FunctionAnalysisThreatScoreData +from revengai.models.function_batch_ann import FunctionBatchAnn as FunctionBatchAnn from revengai.models.function_block_destination_response import FunctionBlockDestinationResponse as FunctionBlockDestinationResponse from revengai.models.function_block_response import FunctionBlockResponse as FunctionBlockResponse from revengai.models.function_blocks_response import FunctionBlocksResponse as FunctionBlocksResponse diff --git a/revengai/api/__init__.py b/revengai/api/__init__.py index 0199858..64445fd 100644 --- a/revengai/api/__init__.py +++ b/revengai/api/__init__.py @@ -21,4 +21,5 @@ from revengai.api.functions_threat_score_api import FunctionsThreatScoreApi from revengai.api.models_api import ModelsApi from revengai.api.search_api import SearchApi +from revengai.api.v1_api import V1Api diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index 2de7a97..515a3e5 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -18,11 +18,11 @@ from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr from typing import Any, List, Optional, Tuple, Union from typing_extensions import Annotated -from revengai.models.ann_function import ANNFunction from revengai.models.analysis_create_request import AnalysisCreateRequest from revengai.models.analysis_update_request import AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy +from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction from revengai.models.base_response_analysis_create_response import BaseResponseAnalysisCreateResponse from revengai.models.base_response_analysis_detail_response import BaseResponseAnalysisDetailResponse from revengai.models.base_response_analysis_function_mapping import BaseResponseAnalysisFunctionMapping @@ -651,7 +651,7 @@ def _delete_analysis_serialize( def find_similar_functions_batch( self, analysis_id: StrictInt, - ann_function: ANNFunction, + app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction, authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, _request_timeout: Union[ None, @@ -672,8 +672,8 @@ def find_similar_functions_batch( :param analysis_id: (required) :type analysis_id: int - :param ann_function: (required) - :type ann_function: ANNFunction + :param app_api_rest_v2_similarity_schema_ann_function: (required) + :type app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction :param authorization: API Key bearer token :type authorization: str :param _request_timeout: timeout setting for this request. If one @@ -700,7 +700,7 @@ def find_similar_functions_batch( _param = self._find_similar_functions_batch_serialize( analysis_id=analysis_id, - ann_function=ann_function, + app_api_rest_v2_similarity_schema_ann_function=app_api_rest_v2_similarity_schema_ann_function, authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, @@ -727,7 +727,7 @@ def find_similar_functions_batch( def find_similar_functions_batch_with_http_info( self, analysis_id: StrictInt, - ann_function: ANNFunction, + app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction, authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, _request_timeout: Union[ None, @@ -748,8 +748,8 @@ def find_similar_functions_batch_with_http_info( :param analysis_id: (required) :type analysis_id: int - :param ann_function: (required) - :type ann_function: ANNFunction + :param app_api_rest_v2_similarity_schema_ann_function: (required) + :type app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction :param authorization: API Key bearer token :type authorization: str :param _request_timeout: timeout setting for this request. If one @@ -776,7 +776,7 @@ def find_similar_functions_batch_with_http_info( _param = self._find_similar_functions_batch_serialize( analysis_id=analysis_id, - ann_function=ann_function, + app_api_rest_v2_similarity_schema_ann_function=app_api_rest_v2_similarity_schema_ann_function, authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, @@ -803,7 +803,7 @@ def find_similar_functions_batch_with_http_info( def find_similar_functions_batch_without_preload_content( self, analysis_id: StrictInt, - ann_function: ANNFunction, + app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction, authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, _request_timeout: Union[ None, @@ -824,8 +824,8 @@ def find_similar_functions_batch_without_preload_content( :param analysis_id: (required) :type analysis_id: int - :param ann_function: (required) - :type ann_function: ANNFunction + :param app_api_rest_v2_similarity_schema_ann_function: (required) + :type app_api_rest_v2_similarity_schema_ann_function: AppApiRestV2SimilaritySchemaANNFunction :param authorization: API Key bearer token :type authorization: str :param _request_timeout: timeout setting for this request. If one @@ -852,7 +852,7 @@ def find_similar_functions_batch_without_preload_content( _param = self._find_similar_functions_batch_serialize( analysis_id=analysis_id, - ann_function=ann_function, + app_api_rest_v2_similarity_schema_ann_function=app_api_rest_v2_similarity_schema_ann_function, authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, @@ -874,7 +874,7 @@ def find_similar_functions_batch_without_preload_content( def _find_similar_functions_batch_serialize( self, analysis_id, - ann_function, + app_api_rest_v2_similarity_schema_ann_function, authorization, _request_auth, _content_type, @@ -905,8 +905,8 @@ def _find_similar_functions_batch_serialize( _header_params['authorization'] = authorization # process the form parameters # process the body parameter - if ann_function is not None: - _body_params = ann_function + if app_api_rest_v2_similarity_schema_ann_function is not None: + _body_params = app_api_rest_v2_similarity_schema_ann_function # set the HTTP header `Accept` diff --git a/revengai/api/v1_api.py b/revengai/api/v1_api.py new file mode 100644 index 0000000..b64875e --- /dev/null +++ b/revengai/api/v1_api.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is Similarity Search Engine for executable binaries + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing import Optional +from typing_extensions import Annotated +from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction +from revengai.models.function_batch_ann import FunctionBatchAnn + +from revengai.api_client import ApiClient, RequestSerialized +from revengai.api_response import ApiResponse +from revengai.rest import RESTResponseType + + +class V1Api: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def batch_symbol_ann( + self, + app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction, + authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FunctionBatchAnn: + """(Deprecated) Batch Symbol ANN using function IDs + + Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database + + :param app_api_rest_v1_ann_schema_ann_function: (required) + :type app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction + :param authorization: API Key bearer token + :type authorization: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/ann/symbol/batch is deprecated.", DeprecationWarning) + + _param = self._batch_symbol_ann_serialize( + app_api_rest_v1_ann_schema_ann_function=app_api_rest_v1_ann_schema_ann_function, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FunctionBatchAnn", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def batch_symbol_ann_with_http_info( + self, + app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction, + authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FunctionBatchAnn]: + """(Deprecated) Batch Symbol ANN using function IDs + + Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database + + :param app_api_rest_v1_ann_schema_ann_function: (required) + :type app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction + :param authorization: API Key bearer token + :type authorization: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/ann/symbol/batch is deprecated.", DeprecationWarning) + + _param = self._batch_symbol_ann_serialize( + app_api_rest_v1_ann_schema_ann_function=app_api_rest_v1_ann_schema_ann_function, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FunctionBatchAnn", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def batch_symbol_ann_without_preload_content( + self, + app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction, + authorization: Annotated[Optional[StrictStr], Field(description="API Key bearer token")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """(Deprecated) Batch Symbol ANN using function IDs + + Takes in an input of functions ID's and settings and finds the nearest functions for each function that's within the database + + :param app_api_rest_v1_ann_schema_ann_function: (required) + :type app_api_rest_v1_ann_schema_ann_function: AppApiRestV1AnnSchemaANNFunction + :param authorization: API Key bearer token + :type authorization: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + warnings.warn("POST /v1/ann/symbol/batch is deprecated.", DeprecationWarning) + + _param = self._batch_symbol_ann_serialize( + app_api_rest_v1_ann_schema_ann_function=app_api_rest_v1_ann_schema_ann_function, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FunctionBatchAnn", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _batch_symbol_ann_serialize( + self, + app_api_rest_v1_ann_schema_ann_function, + authorization, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + if app_api_rest_v1_ann_schema_ann_function is not None: + _body_params = app_api_rest_v1_ann_schema_ann_function + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/ann/symbol/batch', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/revengai/api_client.py b/revengai/api_client.py index 2835e33..547ec4c 100644 --- a/revengai/api_client.py +++ b/revengai/api_client.py @@ -90,7 +90,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/v1.84.0/python' + self.user_agent = 'OpenAPI-Generator/v1.85.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index f3278fd..26b9722 100644 --- a/revengai/configuration.py +++ b/revengai/configuration.py @@ -529,8 +529,8 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: v1.84.0\n"\ - "SDK Package Version: v1.84.0".\ + "Version of the API: v1.85.0\n"\ + "SDK Package Version: v1.85.0".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self) -> List[HostSetting]: diff --git a/revengai/models/__init__.py b/revengai/models/__init__.py index 7a58dda..b69ee13 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -12,7 +12,6 @@ """ # noqa: E501 # import models into model package -from revengai.models.ann_function import ANNFunction from revengai.models.addr import Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating from revengai.models.ai_unstrip_request import AiUnstripRequest @@ -31,12 +30,14 @@ from revengai.models.analysis_update_request import AnalysisUpdateRequest from revengai.models.analysis_update_tags_request import AnalysisUpdateTagsRequest from revengai.models.analysis_update_tags_response import AnalysisUpdateTagsResponse +from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction from revengai.models.app_api_rest_v2_analyses_enums_dynamic_execution_status import AppApiRestV2AnalysesEnumsDynamicExecutionStatus from revengai.models.app_api_rest_v2_analyses_enums_order_by import AppApiRestV2AnalysesEnumsOrderBy from revengai.models.app_api_rest_v2_analyses_responses_tag_item import AppApiRestV2AnalysesResponsesTagItem from revengai.models.app_api_rest_v2_collections_enums_order_by import AppApiRestV2CollectionsEnumsOrderBy from revengai.models.app_api_rest_v2_functions_responses_function import AppApiRestV2FunctionsResponsesFunction from revengai.models.app_api_rest_v2_functions_types_function import AppApiRestV2FunctionsTypesFunction +from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction from revengai.models.app_services_binary_ann_schema_tag_item import AppServicesBinaryAnnSchemaTagItem from revengai.models.app_services_dynamic_execution_schemas_dynamic_execution_status import AppServicesDynamicExecutionSchemasDynamicExecutionStatus from revengai.models.argument import Argument @@ -186,6 +187,7 @@ from revengai.models.file_metadata import FileMetadata from revengai.models.filters import Filters from revengai.models.function_analysis_threat_score_data import FunctionAnalysisThreatScoreData +from revengai.models.function_batch_ann import FunctionBatchAnn from revengai.models.function_block_destination_response import FunctionBlockDestinationResponse from revengai.models.function_block_response import FunctionBlockResponse from revengai.models.function_blocks_response import FunctionBlocksResponse diff --git a/revengai/models/app_api_rest_v1_ann_schema_ann_function.py b/revengai/models/app_api_rest_v1_ann_schema_ann_function.py new file mode 100644 index 0000000..4777cb0 --- /dev/null +++ b/revengai/models/app_api_rest_v1_ann_schema_ann_function.py @@ -0,0 +1,134 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is Similarity Search Engine for executable binaries + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class AppApiRestV1AnnSchemaANNFunction(BaseModel): + """ + AppApiRestV1AnnSchemaANNFunction + """ # noqa: E501 + result_per_function: Optional[Annotated[int, Field(le=20, strict=True)]] = None + distance: Optional[Union[StrictFloat, StrictInt]] = None + function_id_list: List[Optional[StrictInt]] = Field(description="List of function ids to compare") + speculative_function_ids: Optional[List[Any]] = None + collection: Optional[List[Optional[StrictStr]]] = Field(default=None, description="Perform a search on functions within a list of collections") + collection_search_list: Optional[List[Optional[StrictInt]]] = Field(default=None, description="Perform a search on functions within a list of collections") + debug_mode: Optional[StrictBool] = None + debug_types: Optional[List[StrictStr]] = Field(default=None, description="If limiting results to functions with debug names, which type of debug names to include?") + binaries_search_list: Optional[List[Optional[StrictInt]]] = Field(default=None, description="Perform a search on functions within a list of analyses") + __properties: ClassVar[List[str]] = ["result_per_function", "distance", "function_id_list", "speculative_function_ids", "collection", "collection_search_list", "debug_mode", "debug_types", "binaries_search_list"] + + @field_validator('debug_types') + def debug_types_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['USER', 'SYSTEM', 'EXTERNAL']): + raise ValueError("each list item must be one of ('USER', 'SYSTEM', 'EXTERNAL')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AppApiRestV1AnnSchemaANNFunction from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if result_per_function (nullable) is None + # and model_fields_set contains the field + if self.result_per_function is None and "result_per_function" in self.model_fields_set: + _dict['result_per_function'] = None + + # set to None if distance (nullable) is None + # and model_fields_set contains the field + if self.distance is None and "distance" in self.model_fields_set: + _dict['distance'] = None + + # set to None if speculative_function_ids (nullable) is None + # and model_fields_set contains the field + if self.speculative_function_ids is None and "speculative_function_ids" in self.model_fields_set: + _dict['speculative_function_ids'] = None + + # set to None if debug_mode (nullable) is None + # and model_fields_set contains the field + if self.debug_mode is None and "debug_mode" in self.model_fields_set: + _dict['debug_mode'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AppApiRestV1AnnSchemaANNFunction from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "result_per_function": obj.get("result_per_function"), + "distance": obj.get("distance"), + "function_id_list": obj.get("function_id_list"), + "speculative_function_ids": obj.get("speculative_function_ids"), + "collection": obj.get("collection"), + "collection_search_list": obj.get("collection_search_list"), + "debug_mode": obj.get("debug_mode"), + "debug_types": obj.get("debug_types"), + "binaries_search_list": obj.get("binaries_search_list") + }) + return _obj + + diff --git a/revengai/models/ann_function.py b/revengai/models/app_api_rest_v2_similarity_schema_ann_function.py similarity index 94% rename from revengai/models/ann_function.py rename to revengai/models/app_api_rest_v2_similarity_schema_ann_function.py index 2fa3289..d659c70 100644 --- a/revengai/models/ann_function.py +++ b/revengai/models/app_api_rest_v2_similarity_schema_ann_function.py @@ -24,9 +24,9 @@ from typing import Optional, Set from typing_extensions import Self -class ANNFunction(BaseModel): +class AppApiRestV2SimilaritySchemaANNFunction(BaseModel): """ - ANNFunction + AppApiRestV2SimilaritySchemaANNFunction """ # noqa: E501 limit: Optional[StrictInt] = Field(default=5, description="The amount of neighbours per function ID") distance: Optional[Union[StrictFloat, StrictInt]] = Field(default=0.1, description="The distance between two neighbours") @@ -56,7 +56,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ANNFunction from a JSON string""" + """Create an instance of AppApiRestV2SimilaritySchemaANNFunction from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -94,7 +94,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ANNFunction from a dict""" + """Create an instance of AppApiRestV2SimilaritySchemaANNFunction from a dict""" if obj is None: return None diff --git a/revengai/models/function_batch_ann.py b/revengai/models/function_batch_ann.py new file mode 100644 index 0000000..532488c --- /dev/null +++ b/revengai/models/function_batch_ann.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is Similarity Search Engine for executable binaries + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class FunctionBatchAnn(BaseModel): + """ + FunctionBatchAnn + """ # noqa: E501 + success: Optional[Any] = None + settings: Optional[Any] + function_matches: Optional[Any] + __properties: ClassVar[List[str]] = ["success", "settings", "function_matches"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FunctionBatchAnn from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if success (nullable) is None + # and model_fields_set contains the field + if self.success is None and "success" in self.model_fields_set: + _dict['success'] = None + + # set to None if settings (nullable) is None + # and model_fields_set contains the field + if self.settings is None and "settings" in self.model_fields_set: + _dict['settings'] = None + + # set to None if function_matches (nullable) is None + # and model_fields_set contains the field + if self.function_matches is None and "function_matches" in self.model_fields_set: + _dict['function_matches'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FunctionBatchAnn from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "settings": obj.get("settings"), + "function_matches": obj.get("function_matches") + }) + return _obj + + diff --git a/test/test_app_api_rest_v1_ann_schema_ann_function.py b/test/test_app_api_rest_v1_ann_schema_ann_function.py new file mode 100644 index 0000000..3acf958 --- /dev/null +++ b/test/test_app_api_rest_v1_ann_schema_ann_function.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is Similarity Search Engine for executable binaries + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from revengai.models.app_api_rest_v1_ann_schema_ann_function import AppApiRestV1AnnSchemaANNFunction + +class TestAppApiRestV1AnnSchemaANNFunction(unittest.TestCase): + """AppApiRestV1AnnSchemaANNFunction unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AppApiRestV1AnnSchemaANNFunction: + """Test AppApiRestV1AnnSchemaANNFunction + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `AppApiRestV1AnnSchemaANNFunction` + """ + model = AppApiRestV1AnnSchemaANNFunction() + if include_optional: + return AppApiRestV1AnnSchemaANNFunction( + result_per_function = 56, + distance = 1.337, + function_id_list = [ + 56 + ], + speculative_function_ids = [ + null + ], + collection = [ + '' + ], + collection_search_list = [ + 56 + ], + debug_mode = True, + debug_types = [ + 'USER' + ], + binaries_search_list = [ + 56 + ] + ) + else: + return AppApiRestV1AnnSchemaANNFunction( + function_id_list = [ + 56 + ], + ) + """ + + def testAppApiRestV1AnnSchemaANNFunction(self): + """Test AppApiRestV1AnnSchemaANNFunction""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_ann_function.py b/test/test_app_api_rest_v2_similarity_schema_ann_function.py similarity index 59% rename from test/test_ann_function.py rename to test/test_app_api_rest_v2_similarity_schema_ann_function.py index 6845015..5c47aec 100644 --- a/test/test_ann_function.py +++ b/test/test_app_api_rest_v2_similarity_schema_ann_function.py @@ -13,10 +13,10 @@ import unittest -from revengai.models.ann_function import ANNFunction +from revengai.models.app_api_rest_v2_similarity_schema_ann_function import AppApiRestV2SimilaritySchemaANNFunction -class TestANNFunction(unittest.TestCase): - """ANNFunction unit test stubs""" +class TestAppApiRestV2SimilaritySchemaANNFunction(unittest.TestCase): + """AppApiRestV2SimilaritySchemaANNFunction unit test stubs""" def setUp(self): pass @@ -24,16 +24,16 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional) -> ANNFunction: - """Test ANNFunction + def make_instance(self, include_optional) -> AppApiRestV2SimilaritySchemaANNFunction: + """Test AppApiRestV2SimilaritySchemaANNFunction include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # uncomment below to create an instance of `ANNFunction` + # uncomment below to create an instance of `AppApiRestV2SimilaritySchemaANNFunction` """ - model = ANNFunction() + model = AppApiRestV2SimilaritySchemaANNFunction() if include_optional: - return ANNFunction( + return AppApiRestV2SimilaritySchemaANNFunction( limit = 56, distance = 1.337, analysis_search_ids = [ @@ -47,12 +47,12 @@ def make_instance(self, include_optional) -> ANNFunction: debug_only = True ) else: - return ANNFunction( + return AppApiRestV2SimilaritySchemaANNFunction( ) """ - def testANNFunction(self): - """Test ANNFunction""" + def testAppApiRestV2SimilaritySchemaANNFunction(self): + """Test AppApiRestV2SimilaritySchemaANNFunction""" # inst_req_only = self.make_instance(include_optional=False) # inst_req_and_optional = self.make_instance(include_optional=True) diff --git a/test/test_function_batch_ann.py b/test/test_function_batch_ann.py new file mode 100644 index 0000000..515c5d3 --- /dev/null +++ b/test/test_function_batch_ann.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is Similarity Search Engine for executable binaries + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from revengai.models.function_batch_ann import FunctionBatchAnn + +class TestFunctionBatchAnn(unittest.TestCase): + """FunctionBatchAnn unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FunctionBatchAnn: + """Test FunctionBatchAnn + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `FunctionBatchAnn` + """ + model = FunctionBatchAnn() + if include_optional: + return FunctionBatchAnn( + success = None, + settings = None, + function_matches = None + ) + else: + return FunctionBatchAnn( + settings = None, + function_matches = None, + ) + """ + + def testFunctionBatchAnn(self): + """Test FunctionBatchAnn""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_v1_api.py b/test/test_v1_api.py new file mode 100644 index 0000000..1222a47 --- /dev/null +++ b/test/test_v1_api.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is Similarity Search Engine for executable binaries + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from revengai.api.v1_api import V1Api + + +class TestV1Api(unittest.TestCase): + """V1Api unit test stubs""" + + def setUp(self) -> None: + self.api = V1Api() + + def tearDown(self) -> None: + pass + + def test_batch_symbol_ann(self) -> None: + """Test case for batch_symbol_ann + + Batch Symbol ANN using function IDs + """ + pass + + +if __name__ == '__main__': + unittest.main()