From 143705f528ed27ccd60fdd68da817fd4cf8689ad Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 4 Mar 2026 06:22:34 +0000 Subject: [PATCH] Update SDK to version v3.28.2 - Generated from OpenAPI spec version v3.28.2 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 6 + docs/AiDecompilationTaskStatus.md | 16 + docs/AnalysesCoreApi.md | 82 +++++ docs/AnalysisBulkAddTagsRequest.md | 30 ++ docs/AnalysisBulkAddTagsResponse.md | 29 ++ docs/AnalysisBulkAddTagsResponseItem.md | 31 ++ docs/AnalysisRecord.md | 1 + ...BaseResponseAnalysisBulkAddTagsResponse.md | 33 +++ docs/GetAiDecompilationTask.md | 2 +- revengai/__init__.py | 12 +- revengai/api/analyses_core_api.py | 279 ++++++++++++++++++ revengai/api_client.py | 2 +- revengai/configuration.py | 4 +- revengai/models/__init__.py | 5 + .../models/ai_decompilation_task_status.py | 38 +++ .../models/analysis_bulk_add_tags_request.py | 88 ++++++ .../models/analysis_bulk_add_tags_response.py | 94 ++++++ .../analysis_bulk_add_tags_response_item.py | 100 +++++++ revengai/models/analysis_record.py | 14 +- ...esponse_analysis_bulk_add_tags_response.py | 125 ++++++++ revengai/models/get_ai_decompilation_task.py | 5 +- test/test_ai_decompilation_task_status.py | 32 ++ test/test_analyses_core_api.py | 7 + test/test_analysis_bulk_add_tags_request.py | 61 ++++ test/test_analysis_bulk_add_tags_response.py | 61 ++++ ...st_analysis_bulk_add_tags_response_item.py | 54 ++++ test/test_analysis_record.py | 8 +- ...esponse_analysis_bulk_add_tags_response.py | 68 +++++ ...base_response_get_ai_decompilation_task.py | 2 +- test/test_base_response_recent.py | 8 +- test/test_get_ai_decompilation_task.py | 4 +- test/test_recent.py | 16 +- 33 files changed, 1302 insertions(+), 17 deletions(-) create mode 100644 docs/AiDecompilationTaskStatus.md create mode 100644 docs/AnalysisBulkAddTagsRequest.md create mode 100644 docs/AnalysisBulkAddTagsResponse.md create mode 100644 docs/AnalysisBulkAddTagsResponseItem.md create mode 100644 docs/BaseResponseAnalysisBulkAddTagsResponse.md create mode 100644 revengai/models/ai_decompilation_task_status.py create mode 100644 revengai/models/analysis_bulk_add_tags_request.py create mode 100644 revengai/models/analysis_bulk_add_tags_response.py create mode 100644 revengai/models/analysis_bulk_add_tags_response_item.py create mode 100644 revengai/models/base_response_analysis_bulk_add_tags_response.py create mode 100644 test/test_ai_decompilation_task_status.py create mode 100644 test/test_analysis_bulk_add_tags_request.py create mode 100644 test/test_analysis_bulk_add_tags_response.py create mode 100644 test/test_analysis_bulk_add_tags_response_item.py create mode 100644 test/test_base_response_analysis_bulk_add_tags_response.py diff --git a/.sdk-version b/.sdk-version index 4fa0b58..6aee6ff 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.24.0 +v3.28.2 diff --git a/README.md b/README.md index fc594da..4a8eea5 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *AnalysesCommentsApi* | [**delete_analysis_comment**](docs/AnalysesCommentsApi.md#delete_analysis_comment) | **DELETE** /v2/analyses/{analysis_id}/comments/{comment_id} | Delete a comment *AnalysesCommentsApi* | [**get_analysis_comments**](docs/AnalysesCommentsApi.md#get_analysis_comments) | **GET** /v2/analyses/{analysis_id}/comments | Get comments for this analysis *AnalysesCommentsApi* | [**update_analysis_comment**](docs/AnalysesCommentsApi.md#update_analysis_comment) | **PATCH** /v2/analyses/{analysis_id}/comments/{comment_id} | Update a comment +*AnalysesCoreApi* | [**bulk_add_analysis_tags**](docs/AnalysesCoreApi.md#bulk_add_analysis_tags) | **PATCH** /v2/analyses/tags/add | Bulk Add Analysis Tags *AnalysesCoreApi* | [**create_analysis**](docs/AnalysesCoreApi.md#create_analysis) | **POST** /v2/analyses | Create Analysis *AnalysesCoreApi* | [**delete_analysis**](docs/AnalysesCoreApi.md#delete_analysis) | **DELETE** /v2/analyses/{analysis_id} | Delete Analysis *AnalysesCoreApi* | [**get_analysis_basic_info**](docs/AnalysesCoreApi.md#get_analysis_basic_info) | **GET** /v2/analyses/{analysis_id}/basic | Gets basic analysis information @@ -154,8 +155,12 @@ Class | Method | HTTP request | Description - [AdditionalDetailsStatusResponse](docs/AdditionalDetailsStatusResponse.md) - [Addr](docs/Addr.md) - [AiDecompilationRating](docs/AiDecompilationRating.md) + - [AiDecompilationTaskStatus](docs/AiDecompilationTaskStatus.md) - [AiUnstripRequest](docs/AiUnstripRequest.md) - [AnalysisAccessInfo](docs/AnalysisAccessInfo.md) + - [AnalysisBulkAddTagsRequest](docs/AnalysisBulkAddTagsRequest.md) + - [AnalysisBulkAddTagsResponse](docs/AnalysisBulkAddTagsResponse.md) + - [AnalysisBulkAddTagsResponseItem](docs/AnalysisBulkAddTagsResponseItem.md) - [AnalysisConfig](docs/AnalysisConfig.md) - [AnalysisCreateRequest](docs/AnalysisCreateRequest.md) - [AnalysisCreateResponse](docs/AnalysisCreateResponse.md) @@ -183,6 +188,7 @@ Class | Method | HTTP request | Description - [AutoUnstripResponse](docs/AutoUnstripResponse.md) - [BaseResponse](docs/BaseResponse.md) - [BaseResponseAdditionalDetailsStatusResponse](docs/BaseResponseAdditionalDetailsStatusResponse.md) + - [BaseResponseAnalysisBulkAddTagsResponse](docs/BaseResponseAnalysisBulkAddTagsResponse.md) - [BaseResponseAnalysisCreateResponse](docs/BaseResponseAnalysisCreateResponse.md) - [BaseResponseAnalysisDetailResponse](docs/BaseResponseAnalysisDetailResponse.md) - [BaseResponseAnalysisFunctionMapping](docs/BaseResponseAnalysisFunctionMapping.md) diff --git a/docs/AiDecompilationTaskStatus.md b/docs/AiDecompilationTaskStatus.md new file mode 100644 index 0000000..31b2899 --- /dev/null +++ b/docs/AiDecompilationTaskStatus.md @@ -0,0 +1,16 @@ +# AiDecompilationTaskStatus + + +## Enum + +* `UNINITIALISED` (value: `'uninitialised'`) + +* `ERROR` (value: `'error'`) + +* `PENDING` (value: `'pending'`) + +* `SUCCESS` (value: `'success'`) + +[[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/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index 61af217..683cf81 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -4,6 +4,7 @@ All URIs are relative to *https://api.reveng.ai* Method | HTTP request | Description ------------- | ------------- | ------------- +[**bulk_add_analysis_tags**](AnalysesCoreApi.md#bulk_add_analysis_tags) | **PATCH** /v2/analyses/tags/add | Bulk Add Analysis Tags [**create_analysis**](AnalysesCoreApi.md#create_analysis) | **POST** /v2/analyses | Create Analysis [**delete_analysis**](AnalysesCoreApi.md#delete_analysis) | **DELETE** /v2/analyses/{analysis_id} | Delete Analysis [**get_analysis_basic_info**](AnalysesCoreApi.md#get_analysis_basic_info) | **GET** /v2/analyses/{analysis_id}/basic | Gets basic analysis information @@ -20,6 +21,87 @@ Method | HTTP request | Description [**upload_file**](AnalysesCoreApi.md#upload_file) | **POST** /v2/upload | Upload File +# **bulk_add_analysis_tags** +> BaseResponseAnalysisBulkAddTagsResponse bulk_add_analysis_tags(analysis_bulk_add_tags_request) + +Bulk Add Analysis Tags + +Updates analysis tags for multiple analyses. User must be the owner. + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.analysis_bulk_add_tags_request import AnalysisBulkAddTagsRequest +from revengai.models.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse +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.AnalysesCoreApi(api_client) + analysis_bulk_add_tags_request = revengai.AnalysisBulkAddTagsRequest() # AnalysisBulkAddTagsRequest | + + try: + # Bulk Add Analysis Tags + api_response = api_instance.bulk_add_analysis_tags(analysis_bulk_add_tags_request) + print("The response of AnalysesCoreApi->bulk_add_analysis_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnalysesCoreApi->bulk_add_analysis_tags: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **analysis_bulk_add_tags_request** | [**AnalysisBulkAddTagsRequest**](AnalysisBulkAddTagsRequest.md)| | + +### Return type + +[**BaseResponseAnalysisBulkAddTagsResponse**](BaseResponseAnalysisBulkAddTagsResponse.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) + # **create_analysis** > BaseResponseAnalysisCreateResponse create_analysis(analysis_create_request, x_rev_eng_application=x_rev_eng_application) diff --git a/docs/AnalysisBulkAddTagsRequest.md b/docs/AnalysisBulkAddTagsRequest.md new file mode 100644 index 0000000..237af51 --- /dev/null +++ b/docs/AnalysisBulkAddTagsRequest.md @@ -0,0 +1,30 @@ +# AnalysisBulkAddTagsRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tags** | **List[str]** | | +**analysis_ids** | **List[int]** | | + +## Example + +```python +from revengai.models.analysis_bulk_add_tags_request import AnalysisBulkAddTagsRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of AnalysisBulkAddTagsRequest from a JSON string +analysis_bulk_add_tags_request_instance = AnalysisBulkAddTagsRequest.from_json(json) +# print the JSON string representation of the object +print(AnalysisBulkAddTagsRequest.to_json()) + +# convert the object into a dict +analysis_bulk_add_tags_request_dict = analysis_bulk_add_tags_request_instance.to_dict() +# create an instance of AnalysisBulkAddTagsRequest from a dict +analysis_bulk_add_tags_request_from_dict = AnalysisBulkAddTagsRequest.from_dict(analysis_bulk_add_tags_request_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/AnalysisBulkAddTagsResponse.md b/docs/AnalysisBulkAddTagsResponse.md new file mode 100644 index 0000000..2203e82 --- /dev/null +++ b/docs/AnalysisBulkAddTagsResponse.md @@ -0,0 +1,29 @@ +# AnalysisBulkAddTagsResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**results** | [**List[AnalysisBulkAddTagsResponseItem]**](AnalysisBulkAddTagsResponseItem.md) | | + +## Example + +```python +from revengai.models.analysis_bulk_add_tags_response import AnalysisBulkAddTagsResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of AnalysisBulkAddTagsResponse from a JSON string +analysis_bulk_add_tags_response_instance = AnalysisBulkAddTagsResponse.from_json(json) +# print the JSON string representation of the object +print(AnalysisBulkAddTagsResponse.to_json()) + +# convert the object into a dict +analysis_bulk_add_tags_response_dict = analysis_bulk_add_tags_response_instance.to_dict() +# create an instance of AnalysisBulkAddTagsResponse from a dict +analysis_bulk_add_tags_response_from_dict = AnalysisBulkAddTagsResponse.from_dict(analysis_bulk_add_tags_response_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/AnalysisBulkAddTagsResponseItem.md b/docs/AnalysisBulkAddTagsResponseItem.md new file mode 100644 index 0000000..0659c0a --- /dev/null +++ b/docs/AnalysisBulkAddTagsResponseItem.md @@ -0,0 +1,31 @@ +# AnalysisBulkAddTagsResponseItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**analysis_id** | **int** | | +**message** | **str** | | +**error** | **str** | | [optional] + +## Example + +```python +from revengai.models.analysis_bulk_add_tags_response_item import AnalysisBulkAddTagsResponseItem + +# TODO update the JSON string below +json = "{}" +# create an instance of AnalysisBulkAddTagsResponseItem from a JSON string +analysis_bulk_add_tags_response_item_instance = AnalysisBulkAddTagsResponseItem.from_json(json) +# print the JSON string representation of the object +print(AnalysisBulkAddTagsResponseItem.to_json()) + +# convert the object into a dict +analysis_bulk_add_tags_response_item_dict = analysis_bulk_add_tags_response_item_instance.to_dict() +# create an instance of AnalysisBulkAddTagsResponseItem from a dict +analysis_bulk_add_tags_response_item_from_dict = AnalysisBulkAddTagsResponseItem.from_dict(analysis_bulk_add_tags_response_item_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/AnalysisRecord.md b/docs/AnalysisRecord.md index aa71cd8..87a9b53 100644 --- a/docs/AnalysisRecord.md +++ b/docs/AnalysisRecord.md @@ -21,6 +21,7 @@ Name | Type | Description | Notes **dynamic_execution_status** | [**AppApiRestV2AnalysesEnumsDynamicExecutionStatus**](AppApiRestV2AnalysesEnumsDynamicExecutionStatus.md) | | [optional] **dynamic_execution_task_id** | **int** | | [optional] **base_address** | **int** | The base address of the binary | +**tags** | [**List[TagItem]**](TagItem.md) | List of tags associated with the analysis | [optional] ## Example diff --git a/docs/BaseResponseAnalysisBulkAddTagsResponse.md b/docs/BaseResponseAnalysisBulkAddTagsResponse.md new file mode 100644 index 0000000..ff005d8 --- /dev/null +++ b/docs/BaseResponseAnalysisBulkAddTagsResponse.md @@ -0,0 +1,33 @@ +# BaseResponseAnalysisBulkAddTagsResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **bool** | Response status on whether the request succeeded | [optional] [default to True] +**data** | [**AnalysisBulkAddTagsResponse**](AnalysisBulkAddTagsResponse.md) | | [optional] +**message** | **str** | | [optional] +**errors** | [**List[ErrorModel]**](ErrorModel.md) | | [optional] +**meta** | [**MetaModel**](MetaModel.md) | Metadata | [optional] + +## Example + +```python +from revengai.models.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of BaseResponseAnalysisBulkAddTagsResponse from a JSON string +base_response_analysis_bulk_add_tags_response_instance = BaseResponseAnalysisBulkAddTagsResponse.from_json(json) +# print the JSON string representation of the object +print(BaseResponseAnalysisBulkAddTagsResponse.to_json()) + +# convert the object into a dict +base_response_analysis_bulk_add_tags_response_dict = base_response_analysis_bulk_add_tags_response_instance.to_dict() +# create an instance of BaseResponseAnalysisBulkAddTagsResponse from a dict +base_response_analysis_bulk_add_tags_response_from_dict = BaseResponseAnalysisBulkAddTagsResponse.from_dict(base_response_analysis_bulk_add_tags_response_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/GetAiDecompilationTask.md b/docs/GetAiDecompilationTask.md index 6d8274e..207afbb 100644 --- a/docs/GetAiDecompilationTask.md +++ b/docs/GetAiDecompilationTask.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**status** | **str** | | +**status** | [**AiDecompilationTaskStatus**](AiDecompilationTaskStatus.md) | The status of the AI decompilation task | **decompilation** | **str** | | **raw_decompilation** | **str** | | **function_mapping** | [**Dict[str, InverseFunctionMapItem]**](InverseFunctionMapItem.md) | | diff --git a/revengai/__init__.py b/revengai/__init__.py index 47b3c69..1786dc9 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.24.0" +__version__ = "v3.28.2" # Define package exports __all__ = [ @@ -48,8 +48,12 @@ "AdditionalDetailsStatusResponse", "Addr", "AiDecompilationRating", + "AiDecompilationTaskStatus", "AiUnstripRequest", "AnalysisAccessInfo", + "AnalysisBulkAddTagsRequest", + "AnalysisBulkAddTagsResponse", + "AnalysisBulkAddTagsResponseItem", "AnalysisConfig", "AnalysisCreateRequest", "AnalysisCreateResponse", @@ -77,6 +81,7 @@ "AutoUnstripResponse", "BaseResponse", "BaseResponseAdditionalDetailsStatusResponse", + "BaseResponseAnalysisBulkAddTagsResponse", "BaseResponseAnalysisCreateResponse", "BaseResponseAnalysisDetailResponse", "BaseResponseAnalysisFunctionMapping", @@ -377,8 +382,12 @@ from revengai.models.additional_details_status_response import AdditionalDetailsStatusResponse as AdditionalDetailsStatusResponse from revengai.models.addr import Addr as Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating as AiDecompilationRating +from revengai.models.ai_decompilation_task_status import AiDecompilationTaskStatus as AiDecompilationTaskStatus from revengai.models.ai_unstrip_request import AiUnstripRequest as AiUnstripRequest from revengai.models.analysis_access_info import AnalysisAccessInfo as AnalysisAccessInfo +from revengai.models.analysis_bulk_add_tags_request import AnalysisBulkAddTagsRequest as AnalysisBulkAddTagsRequest +from revengai.models.analysis_bulk_add_tags_response import AnalysisBulkAddTagsResponse as AnalysisBulkAddTagsResponse +from revengai.models.analysis_bulk_add_tags_response_item import AnalysisBulkAddTagsResponseItem as AnalysisBulkAddTagsResponseItem from revengai.models.analysis_config import AnalysisConfig as AnalysisConfig from revengai.models.analysis_create_request import AnalysisCreateRequest as AnalysisCreateRequest from revengai.models.analysis_create_response import AnalysisCreateResponse as AnalysisCreateResponse @@ -406,6 +415,7 @@ from revengai.models.auto_unstrip_response import AutoUnstripResponse as AutoUnstripResponse from revengai.models.base_response import BaseResponse as BaseResponse from revengai.models.base_response_additional_details_status_response import BaseResponseAdditionalDetailsStatusResponse as BaseResponseAdditionalDetailsStatusResponse +from revengai.models.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse as BaseResponseAnalysisBulkAddTagsResponse from revengai.models.base_response_analysis_create_response import BaseResponseAnalysisCreateResponse as BaseResponseAnalysisCreateResponse from revengai.models.base_response_analysis_detail_response import BaseResponseAnalysisDetailResponse as BaseResponseAnalysisDetailResponse from revengai.models.base_response_analysis_function_mapping import BaseResponseAnalysisFunctionMapping as BaseResponseAnalysisFunctionMapping diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index 98677dd..a263afc 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -18,11 +18,13 @@ from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr from typing import Any, List, Optional, Tuple, Union from typing_extensions import Annotated +from revengai.models.analysis_bulk_add_tags_request import AnalysisBulkAddTagsRequest 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.base_response import BaseResponse +from revengai.models.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse 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 @@ -62,6 +64,283 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + def bulk_add_analysis_tags( + self, + analysis_bulk_add_tags_request: AnalysisBulkAddTagsRequest, + _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, + ) -> BaseResponseAnalysisBulkAddTagsResponse: + """Bulk Add Analysis Tags + + Updates analysis tags for multiple analyses. User must be the owner. + + :param analysis_bulk_add_tags_request: (required) + :type analysis_bulk_add_tags_request: AnalysisBulkAddTagsRequest + :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 + + _param = self._bulk_add_analysis_tags_serialize( + analysis_bulk_add_tags_request=analysis_bulk_add_tags_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseAnalysisBulkAddTagsResponse", + '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 bulk_add_analysis_tags_with_http_info( + self, + analysis_bulk_add_tags_request: AnalysisBulkAddTagsRequest, + _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[BaseResponseAnalysisBulkAddTagsResponse]: + """Bulk Add Analysis Tags + + Updates analysis tags for multiple analyses. User must be the owner. + + :param analysis_bulk_add_tags_request: (required) + :type analysis_bulk_add_tags_request: AnalysisBulkAddTagsRequest + :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 + + _param = self._bulk_add_analysis_tags_serialize( + analysis_bulk_add_tags_request=analysis_bulk_add_tags_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseAnalysisBulkAddTagsResponse", + '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 bulk_add_analysis_tags_without_preload_content( + self, + analysis_bulk_add_tags_request: AnalysisBulkAddTagsRequest, + _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: + """Bulk Add Analysis Tags + + Updates analysis tags for multiple analyses. User must be the owner. + + :param analysis_bulk_add_tags_request: (required) + :type analysis_bulk_add_tags_request: AnalysisBulkAddTagsRequest + :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 + + _param = self._bulk_add_analysis_tags_serialize( + analysis_bulk_add_tags_request=analysis_bulk_add_tags_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseAnalysisBulkAddTagsResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _bulk_add_analysis_tags_serialize( + self, + analysis_bulk_add_tags_request, + _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 + # process the form parameters + # process the body parameter + if analysis_bulk_add_tags_request is not None: + _body_params = analysis_bulk_add_tags_request + + + # 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='PATCH', + resource_path='/v2/analyses/tags/add', + 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 + ) + + + + @validate_call def create_analysis( self, diff --git a/revengai/api_client.py b/revengai/api_client.py index 8e9b215..1b6e6de 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/v3.24.0/python' + self.user_agent = 'OpenAPI-Generator/v3.28.2/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index c22a449..f11c908 100644 --- a/revengai/configuration.py +++ b/revengai/configuration.py @@ -533,8 +533,8 @@ def to_debug_report(self) -> str: return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: v3.24.0\n"\ - "SDK Package Version: v3.24.0".\ + "Version of the API: v3.28.2\n"\ + "SDK Package Version: v3.28.2".\ 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 2536248..32bbf46 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -15,8 +15,12 @@ from revengai.models.additional_details_status_response import AdditionalDetailsStatusResponse from revengai.models.addr import Addr from revengai.models.ai_decompilation_rating import AiDecompilationRating +from revengai.models.ai_decompilation_task_status import AiDecompilationTaskStatus from revengai.models.ai_unstrip_request import AiUnstripRequest from revengai.models.analysis_access_info import AnalysisAccessInfo +from revengai.models.analysis_bulk_add_tags_request import AnalysisBulkAddTagsRequest +from revengai.models.analysis_bulk_add_tags_response import AnalysisBulkAddTagsResponse +from revengai.models.analysis_bulk_add_tags_response_item import AnalysisBulkAddTagsResponseItem from revengai.models.analysis_config import AnalysisConfig from revengai.models.analysis_create_request import AnalysisCreateRequest from revengai.models.analysis_create_response import AnalysisCreateResponse @@ -44,6 +48,7 @@ from revengai.models.auto_unstrip_response import AutoUnstripResponse from revengai.models.base_response import BaseResponse from revengai.models.base_response_additional_details_status_response import BaseResponseAdditionalDetailsStatusResponse +from revengai.models.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse 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 diff --git a/revengai/models/ai_decompilation_task_status.py b/revengai/models/ai_decompilation_task_status.py new file mode 100644 index 0000000..eb1de67 --- /dev/null +++ b/revengai/models/ai_decompilation_task_status.py @@ -0,0 +1,38 @@ +# 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 json +from enum import Enum +from typing_extensions import Self + + +class AiDecompilationTaskStatus(str, Enum): + """ + AiDecompilationTaskStatus + """ + + """ + allowed enum values + """ + UNINITIALISED = 'uninitialised' + ERROR = 'error' + PENDING = 'pending' + SUCCESS = 'success' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of AiDecompilationTaskStatus from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/revengai/models/analysis_bulk_add_tags_request.py b/revengai/models/analysis_bulk_add_tags_request.py new file mode 100644 index 0000000..8a0ea89 --- /dev/null +++ b/revengai/models/analysis_bulk_add_tags_request.py @@ -0,0 +1,88 @@ +# 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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AnalysisBulkAddTagsRequest(BaseModel): + """ + AnalysisBulkAddTagsRequest + """ # noqa: E501 + tags: List[StrictStr] + analysis_ids: List[StrictInt] + __properties: ClassVar[List[str]] = ["tags", "analysis_ids"] + + 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 AnalysisBulkAddTagsRequest 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, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AnalysisBulkAddTagsRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tags": obj.get("tags"), + "analysis_ids": obj.get("analysis_ids") + }) + return _obj + + diff --git a/revengai/models/analysis_bulk_add_tags_response.py b/revengai/models/analysis_bulk_add_tags_response.py new file mode 100644 index 0000000..cbfb082 --- /dev/null +++ b/revengai/models/analysis_bulk_add_tags_response.py @@ -0,0 +1,94 @@ +# 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 +from revengai.models.analysis_bulk_add_tags_response_item import AnalysisBulkAddTagsResponseItem +from typing import Optional, Set +from typing_extensions import Self + +class AnalysisBulkAddTagsResponse(BaseModel): + """ + AnalysisBulkAddTagsResponse + """ # noqa: E501 + results: List[AnalysisBulkAddTagsResponseItem] + __properties: ClassVar[List[str]] = ["results"] + + 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 AnalysisBulkAddTagsResponse 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, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AnalysisBulkAddTagsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [AnalysisBulkAddTagsResponseItem.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None + }) + return _obj + + diff --git a/revengai/models/analysis_bulk_add_tags_response_item.py b/revengai/models/analysis_bulk_add_tags_response_item.py new file mode 100644 index 0000000..ee8a80b --- /dev/null +++ b/revengai/models/analysis_bulk_add_tags_response_item.py @@ -0,0 +1,100 @@ +# 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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AnalysisBulkAddTagsResponseItem(BaseModel): + """ + AnalysisBulkAddTagsResponseItem + """ # noqa: E501 + analysis_id: StrictInt + message: Optional[StrictStr] + error: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["analysis_id", "message", "error"] + + 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 AnalysisBulkAddTagsResponseItem 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 message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + # set to None if error (nullable) is None + # and model_fields_set contains the field + if self.error is None and "error" in self.model_fields_set: + _dict['error'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AnalysisBulkAddTagsResponseItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "analysis_id": obj.get("analysis_id"), + "message": obj.get("message"), + "error": obj.get("error") + }) + return _obj + + diff --git a/revengai/models/analysis_record.py b/revengai/models/analysis_record.py index f44d11c..5614826 100644 --- a/revengai/models/analysis_record.py +++ b/revengai/models/analysis_record.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from revengai.models.app_api_rest_v2_analyses_enums_dynamic_execution_status import AppApiRestV2AnalysesEnumsDynamicExecutionStatus +from revengai.models.tag_item import TagItem from typing import Optional, Set from typing_extensions import Self @@ -43,7 +44,8 @@ class AnalysisRecord(BaseModel): dynamic_execution_status: Optional[AppApiRestV2AnalysesEnumsDynamicExecutionStatus] = None dynamic_execution_task_id: Optional[StrictInt] = None base_address: StrictInt = Field(description="The base address of the binary") - __properties: ClassVar[List[str]] = ["analysis_id", "analysis_scope", "binary_id", "model_id", "model_name", "status", "creation", "is_owner", "binary_name", "sha_256_hash", "function_boundaries_hash", "binary_size", "username", "dynamic_execution_status", "dynamic_execution_task_id", "base_address"] + tags: Optional[List[TagItem]] = Field(default=None, description="List of tags associated with the analysis") + __properties: ClassVar[List[str]] = ["analysis_id", "analysis_scope", "binary_id", "model_id", "model_name", "status", "creation", "is_owner", "binary_name", "sha_256_hash", "function_boundaries_hash", "binary_size", "username", "dynamic_execution_status", "dynamic_execution_task_id", "base_address", "tags"] model_config = ConfigDict( populate_by_name=True, @@ -84,6 +86,13 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in tags (list) + _items = [] + if self.tags: + for _item_tags in self.tags: + if _item_tags: + _items.append(_item_tags.to_dict()) + _dict['tags'] = _items # set to None if dynamic_execution_status (nullable) is None # and model_fields_set contains the field if self.dynamic_execution_status is None and "dynamic_execution_status" in self.model_fields_set: @@ -121,7 +130,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "username": obj.get("username"), "dynamic_execution_status": obj.get("dynamic_execution_status"), "dynamic_execution_task_id": obj.get("dynamic_execution_task_id"), - "base_address": obj.get("base_address") + "base_address": obj.get("base_address"), + "tags": [TagItem.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None }) return _obj diff --git a/revengai/models/base_response_analysis_bulk_add_tags_response.py b/revengai/models/base_response_analysis_bulk_add_tags_response.py new file mode 100644 index 0000000..e69d56e --- /dev/null +++ b/revengai/models/base_response_analysis_bulk_add_tags_response.py @@ -0,0 +1,125 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.analysis_bulk_add_tags_response import AnalysisBulkAddTagsResponse +from revengai.models.error_model import ErrorModel +from revengai.models.meta_model import MetaModel +from typing import Optional, Set +from typing_extensions import Self + +class BaseResponseAnalysisBulkAddTagsResponse(BaseModel): + """ + BaseResponseAnalysisBulkAddTagsResponse + """ # noqa: E501 + status: Optional[StrictBool] = Field(default=True, description="Response status on whether the request succeeded") + data: Optional[AnalysisBulkAddTagsResponse] = None + message: Optional[StrictStr] = None + errors: Optional[List[ErrorModel]] = None + meta: Optional[MetaModel] = Field(default=None, description="Metadata") + __properties: ClassVar[List[str]] = ["status", "data", "message", "errors", "meta"] + + 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 BaseResponseAnalysisBulkAddTagsResponse 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, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in errors (list) + _items = [] + if self.errors: + for _item_errors in self.errors: + if _item_errors: + _items.append(_item_errors.to_dict()) + _dict['errors'] = _items + # override the default output from pydantic by calling `to_dict()` of meta + if self.meta: + _dict['meta'] = self.meta.to_dict() + # set to None if data (nullable) is None + # and model_fields_set contains the field + if self.data is None and "data" in self.model_fields_set: + _dict['data'] = None + + # set to None if message (nullable) is None + # and model_fields_set contains the field + if self.message is None and "message" in self.model_fields_set: + _dict['message'] = None + + # set to None if errors (nullable) is None + # and model_fields_set contains the field + if self.errors is None and "errors" in self.model_fields_set: + _dict['errors'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BaseResponseAnalysisBulkAddTagsResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status") if obj.get("status") is not None else True, + "data": AnalysisBulkAddTagsResponse.from_dict(obj["data"]) if obj.get("data") is not None else None, + "message": obj.get("message"), + "errors": [ErrorModel.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None, + "meta": MetaModel.from_dict(obj["meta"]) if obj.get("meta") is not None else None + }) + return _obj + + diff --git a/revengai/models/get_ai_decompilation_task.py b/revengai/models/get_ai_decompilation_task.py index 701503d..039c1d3 100644 --- a/revengai/models/get_ai_decompilation_task.py +++ b/revengai/models/get_ai_decompilation_task.py @@ -16,8 +16,9 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.ai_decompilation_task_status import AiDecompilationTaskStatus from revengai.models.function_mapping_full import FunctionMappingFull from revengai.models.inverse_function_map_item import InverseFunctionMapItem from typing import Optional, Set @@ -27,7 +28,7 @@ class GetAiDecompilationTask(BaseModel): """ GetAiDecompilationTask """ # noqa: E501 - status: StrictStr + status: AiDecompilationTaskStatus = Field(description="The status of the AI decompilation task") decompilation: Optional[StrictStr] raw_decompilation: Optional[StrictStr] function_mapping: Optional[Dict[str, InverseFunctionMapItem]] diff --git a/test/test_ai_decompilation_task_status.py b/test/test_ai_decompilation_task_status.py new file mode 100644 index 0000000..0ad07f4 --- /dev/null +++ b/test/test_ai_decompilation_task_status.py @@ -0,0 +1,32 @@ +# 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.ai_decompilation_task_status import AiDecompilationTaskStatus + +class TestAiDecompilationTaskStatus(unittest.TestCase): + """AiDecompilationTaskStatus unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testAiDecompilationTaskStatus(self): + """Test AiDecompilationTaskStatus""" + # inst = AiDecompilationTaskStatus() + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_analyses_core_api.py b/test/test_analyses_core_api.py index 010c482..ff2fb03 100644 --- a/test/test_analyses_core_api.py +++ b/test/test_analyses_core_api.py @@ -25,6 +25,13 @@ def setUp(self) -> None: def tearDown(self) -> None: pass + def test_bulk_add_analysis_tags(self) -> None: + """Test case for bulk_add_analysis_tags + + Bulk Add Analysis Tags + """ + pass + def test_create_analysis(self) -> None: """Test case for create_analysis diff --git a/test/test_analysis_bulk_add_tags_request.py b/test/test_analysis_bulk_add_tags_request.py new file mode 100644 index 0000000..fdbe8f7 --- /dev/null +++ b/test/test_analysis_bulk_add_tags_request.py @@ -0,0 +1,61 @@ +# 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.analysis_bulk_add_tags_request import AnalysisBulkAddTagsRequest + +class TestAnalysisBulkAddTagsRequest(unittest.TestCase): + """AnalysisBulkAddTagsRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AnalysisBulkAddTagsRequest: + """Test AnalysisBulkAddTagsRequest + 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 `AnalysisBulkAddTagsRequest` + """ + model = AnalysisBulkAddTagsRequest() + if include_optional: + return AnalysisBulkAddTagsRequest( + tags = [ + '' + ], + analysis_ids = [ + 56 + ] + ) + else: + return AnalysisBulkAddTagsRequest( + tags = [ + '' + ], + analysis_ids = [ + 56 + ], + ) + """ + + def testAnalysisBulkAddTagsRequest(self): + """Test AnalysisBulkAddTagsRequest""" + # 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_analysis_bulk_add_tags_response.py b/test/test_analysis_bulk_add_tags_response.py new file mode 100644 index 0000000..fb63045 --- /dev/null +++ b/test/test_analysis_bulk_add_tags_response.py @@ -0,0 +1,61 @@ +# 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.analysis_bulk_add_tags_response import AnalysisBulkAddTagsResponse + +class TestAnalysisBulkAddTagsResponse(unittest.TestCase): + """AnalysisBulkAddTagsResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AnalysisBulkAddTagsResponse: + """Test AnalysisBulkAddTagsResponse + 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 `AnalysisBulkAddTagsResponse` + """ + model = AnalysisBulkAddTagsResponse() + if include_optional: + return AnalysisBulkAddTagsResponse( + results = [ + revengai.models.analysis_bulk_add_tags_response_item.AnalysisBulkAddTagsResponseItem( + analysis_id = 56, + message = '', + error = '', ) + ] + ) + else: + return AnalysisBulkAddTagsResponse( + results = [ + revengai.models.analysis_bulk_add_tags_response_item.AnalysisBulkAddTagsResponseItem( + analysis_id = 56, + message = '', + error = '', ) + ], + ) + """ + + def testAnalysisBulkAddTagsResponse(self): + """Test AnalysisBulkAddTagsResponse""" + # 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_analysis_bulk_add_tags_response_item.py b/test/test_analysis_bulk_add_tags_response_item.py new file mode 100644 index 0000000..a27c21d --- /dev/null +++ b/test/test_analysis_bulk_add_tags_response_item.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.analysis_bulk_add_tags_response_item import AnalysisBulkAddTagsResponseItem + +class TestAnalysisBulkAddTagsResponseItem(unittest.TestCase): + """AnalysisBulkAddTagsResponseItem unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AnalysisBulkAddTagsResponseItem: + """Test AnalysisBulkAddTagsResponseItem + 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 `AnalysisBulkAddTagsResponseItem` + """ + model = AnalysisBulkAddTagsResponseItem() + if include_optional: + return AnalysisBulkAddTagsResponseItem( + analysis_id = 56, + message = '', + error = '' + ) + else: + return AnalysisBulkAddTagsResponseItem( + analysis_id = 56, + message = '', + ) + """ + + def testAnalysisBulkAddTagsResponseItem(self): + """Test AnalysisBulkAddTagsResponseItem""" + # 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_analysis_record.py b/test/test_analysis_record.py index 8f62516..d22d179 100644 --- a/test/test_analysis_record.py +++ b/test/test_analysis_record.py @@ -49,7 +49,13 @@ def make_instance(self, include_optional) -> AnalysisRecord: username = '', dynamic_execution_status = 'PENDING', dynamic_execution_task_id = 56, - base_address = 56 + base_address = 56, + tags = [ + revengai.models.tag_item.TagItem( + name = '', + origin = '', + collection_id = 56, ) + ] ) else: return AnalysisRecord( diff --git a/test/test_base_response_analysis_bulk_add_tags_response.py b/test/test_base_response_analysis_bulk_add_tags_response.py new file mode 100644 index 0000000..d63c2c3 --- /dev/null +++ b/test/test_base_response_analysis_bulk_add_tags_response.py @@ -0,0 +1,68 @@ +# 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.base_response_analysis_bulk_add_tags_response import BaseResponseAnalysisBulkAddTagsResponse + +class TestBaseResponseAnalysisBulkAddTagsResponse(unittest.TestCase): + """BaseResponseAnalysisBulkAddTagsResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BaseResponseAnalysisBulkAddTagsResponse: + """Test BaseResponseAnalysisBulkAddTagsResponse + 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 `BaseResponseAnalysisBulkAddTagsResponse` + """ + model = BaseResponseAnalysisBulkAddTagsResponse() + if include_optional: + return BaseResponseAnalysisBulkAddTagsResponse( + status = True, + data = revengai.models.analysis_bulk_add_tags_response.AnalysisBulkAddTagsResponse( + results = [ + revengai.models.analysis_bulk_add_tags_response_item.AnalysisBulkAddTagsResponseItem( + analysis_id = 56, + message = '', + error = '', ) + ], ), + message = '', + errors = [ + revengai.models.error_model.ErrorModel( + code = '', + message = '', ) + ], + meta = revengai.models.meta_model.MetaModel( + pagination = revengai.models.pagination_model.PaginationModel( + page_size = 56, + page_number = 56, + has_next_page = True, ), ) + ) + else: + return BaseResponseAnalysisBulkAddTagsResponse( + ) + """ + + def testBaseResponseAnalysisBulkAddTagsResponse(self): + """Test BaseResponseAnalysisBulkAddTagsResponse""" + # 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_base_response_get_ai_decompilation_task.py b/test/test_base_response_get_ai_decompilation_task.py index 376ef1e..622ed39 100644 --- a/test/test_base_response_get_ai_decompilation_task.py +++ b/test/test_base_response_get_ai_decompilation_task.py @@ -36,7 +36,7 @@ def make_instance(self, include_optional) -> BaseResponseGetAiDecompilationTask: return BaseResponseGetAiDecompilationTask( status = True, data = revengai.models.get_ai_decompilation_task.GetAiDecompilationTask( - status = '', + status = 'uninitialised', decompilation = '', raw_decompilation = '', function_mapping = { diff --git a/test/test_base_response_recent.py b/test/test_base_response_recent.py index b7fc946..7bc3f16 100644 --- a/test/test_base_response_recent.py +++ b/test/test_base_response_recent.py @@ -53,7 +53,13 @@ def make_instance(self, include_optional) -> BaseResponseRecent: username = '', dynamic_execution_status = 'PENDING', dynamic_execution_task_id = 56, - base_address = 56, ) + base_address = 56, + tags = [ + revengai.models.tag_item.TagItem( + name = '', + origin = '', + collection_id = 56, ) + ], ) ], ), message = '', errors = [ diff --git a/test/test_get_ai_decompilation_task.py b/test/test_get_ai_decompilation_task.py index 8168df8..b39ef14 100644 --- a/test/test_get_ai_decompilation_task.py +++ b/test/test_get_ai_decompilation_task.py @@ -34,7 +34,7 @@ def make_instance(self, include_optional) -> GetAiDecompilationTask: model = GetAiDecompilationTask() if include_optional: return GetAiDecompilationTask( - status = '', + status = 'uninitialised', decompilation = '', raw_decompilation = '', function_mapping = { @@ -99,7 +99,7 @@ def make_instance(self, include_optional) -> GetAiDecompilationTask: ) else: return GetAiDecompilationTask( - status = '', + status = 'uninitialised', decompilation = '', raw_decompilation = '', function_mapping = { diff --git a/test/test_recent.py b/test/test_recent.py index 5aef1a4..8c2b300 100644 --- a/test/test_recent.py +++ b/test/test_recent.py @@ -51,7 +51,13 @@ def make_instance(self, include_optional) -> Recent: username = '', dynamic_execution_status = 'PENDING', dynamic_execution_task_id = 56, - base_address = 56, ) + base_address = 56, + tags = [ + revengai.models.tag_item.TagItem( + name = '', + origin = '', + collection_id = 56, ) + ], ) ] ) else: @@ -73,7 +79,13 @@ def make_instance(self, include_optional) -> Recent: username = '', dynamic_execution_status = 'PENDING', dynamic_execution_task_id = 56, - base_address = 56, ) + base_address = 56, + tags = [ + revengai.models.tag_item.TagItem( + name = '', + origin = '', + collection_id = 56, ) + ], ) ], ) """