From 063b236aeab050266b4ce581669452d453a542ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Jun 2026 08:10:15 +0000 Subject: [PATCH] Update SDK to version v3.93.0 - Generated from OpenAPI spec version v3.93.0 - Auto-generated by GitHub Actions --- .sdk-version | 2 +- README.md | 7 + docs/AIDecompFunctionMapping.md | 42 ++ docs/AIDecompInverseFunctionMapItem.md | 31 + docs/AIDecompInverseStringMapItem.md | 30 + docs/CollectionsApi.md | 179 +++++ docs/PatchCollectionInputBody.md | 31 + docs/PatchCollectionOutputBody.md | 38 ++ docs/TokenisedData.md | 2 +- revengai/__init__.py | 12 +- revengai/api/collections_api.py | 642 +++++++++++++++++- revengai/api_client.py | 2 +- revengai/configuration.py | 4 +- revengai/models/__init__.py | 5 + revengai/models/ai_decomp_function_mapping.py | 290 ++++++++ .../ai_decomp_inverse_function_map_item.py | 107 +++ .../ai_decomp_inverse_string_map_item.py | 105 +++ .../models/patch_collection_input_body.py | 103 +++ .../models/patch_collection_output_body.py | 118 ++++ revengai/models/replacement_value.py | 9 +- revengai/models/tokenised_data.py | 6 +- 21 files changed, 1728 insertions(+), 37 deletions(-) create mode 100644 docs/AIDecompFunctionMapping.md create mode 100644 docs/AIDecompInverseFunctionMapItem.md create mode 100644 docs/AIDecompInverseStringMapItem.md create mode 100644 docs/PatchCollectionInputBody.md create mode 100644 docs/PatchCollectionOutputBody.md create mode 100644 revengai/models/ai_decomp_function_mapping.py create mode 100644 revengai/models/ai_decomp_inverse_function_map_item.py create mode 100644 revengai/models/ai_decomp_inverse_string_map_item.py create mode 100644 revengai/models/patch_collection_input_body.py create mode 100644 revengai/models/patch_collection_output_body.py diff --git a/.sdk-version b/.sdk-version index 3a74886..3bab994 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.92.0 +v3.93.0 diff --git a/README.md b/README.md index 75c4618..2955144 100644 --- a/README.md +++ b/README.md @@ -104,8 +104,10 @@ Class | Method | HTTP request | Description *CollectionsApi* | [**update_collection_binaries**](docs/CollectionsApi.md#update_collection_binaries) | **PATCH** /v2/collections/{collection_id}/binaries | Updates a collection binaries *CollectionsApi* | [**update_collection_tags**](docs/CollectionsApi.md#update_collection_tags) | **PATCH** /v2/collections/{collection_id}/tags | Updates a collection tags *CollectionsApi* | [**v3_create_collection**](docs/CollectionsApi.md#v3_create_collection) | **POST** /v3/collections | Create a collection. +*CollectionsApi* | [**v3_delete_collection**](docs/CollectionsApi.md#v3_delete_collection) | **DELETE** /v3/collections/{collection_id} | Delete a collection. *CollectionsApi* | [**v3_get_collection**](docs/CollectionsApi.md#v3_get_collection) | **GET** /v3/collections/{collection_id} | Get a collection. *CollectionsApi* | [**v3_list_collections**](docs/CollectionsApi.md#v3_list_collections) | **GET** /v3/collections | List collections. +*CollectionsApi* | [**v3_patch_collection**](docs/CollectionsApi.md#v3_patch_collection) | **PATCH** /v3/collections/{collection_id} | Update a collection. *CollectionsApi* | [**v3_patch_collection_binaries**](docs/CollectionsApi.md#v3_patch_collection_binaries) | **PATCH** /v3/collections/{collection_id}/binaries | Replace the binaries in a collection. *CollectionsApi* | [**v3_patch_collection_tags**](docs/CollectionsApi.md#v3_patch_collection_tags) | **PATCH** /v3/collections/{collection_id}/tags | Replace the tags on a collection. *ConfigApi* | [**get_config**](docs/ConfigApi.md#get_config) | **GET** /v2/config | Get Config @@ -187,6 +189,9 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [AIDecompFunctionMapping](docs/AIDecompFunctionMapping.md) + - [AIDecompInverseFunctionMapItem](docs/AIDecompInverseFunctionMapItem.md) + - [AIDecompInverseStringMapItem](docs/AIDecompInverseStringMapItem.md) - [APIError](docs/APIError.md) - [AddCalleeInputBody](docs/AddCalleeInputBody.md) - [AddUserStringInputBody](docs/AddUserStringInputBody.md) @@ -502,6 +507,8 @@ Class | Method | HTTP request | Description - [Params](docs/Params.md) - [PatchCollectionBinariesInputBody](docs/PatchCollectionBinariesInputBody.md) - [PatchCollectionBinariesOutputBody](docs/PatchCollectionBinariesOutputBody.md) + - [PatchCollectionInputBody](docs/PatchCollectionInputBody.md) + - [PatchCollectionOutputBody](docs/PatchCollectionOutputBody.md) - [PatchCollectionTagsInputBody](docs/PatchCollectionTagsInputBody.md) - [PatchCollectionTagsOutputBody](docs/PatchCollectionTagsOutputBody.md) - [PatchCommentBody](docs/PatchCommentBody.md) diff --git a/docs/AIDecompFunctionMapping.md b/docs/AIDecompFunctionMapping.md new file mode 100644 index 0000000..0167aac --- /dev/null +++ b/docs/AIDecompFunctionMapping.md @@ -0,0 +1,42 @@ +# AIDecompFunctionMapping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fields** | **Dict[str, Dict[str, ReplacementValue]]** | | +**inverse_function_map** | [**Dict[str, AIDecompInverseFunctionMapItem]**](AIDecompInverseFunctionMapItem.md) | | +**inverse_string_map** | [**Dict[str, AIDecompInverseStringMapItem]**](AIDecompInverseStringMapItem.md) | | +**unmatched_custom_function_pointers** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_custom_types** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_enums** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_external_vars** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_functions** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_global_vars** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_go_to_labels** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_strings** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_variadic_lists** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**unmatched_vars** | [**Dict[str, ReplacementValue]**](ReplacementValue.md) | | +**user_override_mappings** | **Dict[str, str]** | | + +## Example + +```python +from revengai.models.ai_decomp_function_mapping import AIDecompFunctionMapping + +# TODO update the JSON string below +json = "{}" +# create an instance of AIDecompFunctionMapping from a JSON string +ai_decomp_function_mapping_instance = AIDecompFunctionMapping.from_json(json) +# print the JSON string representation of the object +print(AIDecompFunctionMapping.to_json()) + +# convert the object into a dict +ai_decomp_function_mapping_dict = ai_decomp_function_mapping_instance.to_dict() +# create an instance of AIDecompFunctionMapping from a dict +ai_decomp_function_mapping_from_dict = AIDecompFunctionMapping.from_dict(ai_decomp_function_mapping_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/AIDecompInverseFunctionMapItem.md b/docs/AIDecompInverseFunctionMapItem.md new file mode 100644 index 0000000..3c7e0b9 --- /dev/null +++ b/docs/AIDecompInverseFunctionMapItem.md @@ -0,0 +1,31 @@ +# AIDecompInverseFunctionMapItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**addr** | [**NumericAddr**](NumericAddr.md) | | +**is_external** | **bool** | | +**name** | **str** | | + +## Example + +```python +from revengai.models.ai_decomp_inverse_function_map_item import AIDecompInverseFunctionMapItem + +# TODO update the JSON string below +json = "{}" +# create an instance of AIDecompInverseFunctionMapItem from a JSON string +ai_decomp_inverse_function_map_item_instance = AIDecompInverseFunctionMapItem.from_json(json) +# print the JSON string representation of the object +print(AIDecompInverseFunctionMapItem.to_json()) + +# convert the object into a dict +ai_decomp_inverse_function_map_item_dict = ai_decomp_inverse_function_map_item_instance.to_dict() +# create an instance of AIDecompInverseFunctionMapItem from a dict +ai_decomp_inverse_function_map_item_from_dict = AIDecompInverseFunctionMapItem.from_dict(ai_decomp_inverse_function_map_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/AIDecompInverseStringMapItem.md b/docs/AIDecompInverseStringMapItem.md new file mode 100644 index 0000000..f4cae76 --- /dev/null +++ b/docs/AIDecompInverseStringMapItem.md @@ -0,0 +1,30 @@ +# AIDecompInverseStringMapItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**addr** | [**NumericAddr**](NumericAddr.md) | | +**string** | **str** | | + +## Example + +```python +from revengai.models.ai_decomp_inverse_string_map_item import AIDecompInverseStringMapItem + +# TODO update the JSON string below +json = "{}" +# create an instance of AIDecompInverseStringMapItem from a JSON string +ai_decomp_inverse_string_map_item_instance = AIDecompInverseStringMapItem.from_json(json) +# print the JSON string representation of the object +print(AIDecompInverseStringMapItem.to_json()) + +# convert the object into a dict +ai_decomp_inverse_string_map_item_dict = ai_decomp_inverse_string_map_item_instance.to_dict() +# create an instance of AIDecompInverseStringMapItem from a dict +ai_decomp_inverse_string_map_item_from_dict = AIDecompInverseStringMapItem.from_dict(ai_decomp_inverse_string_map_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/CollectionsApi.md b/docs/CollectionsApi.md index de88635..b427ccb 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -12,8 +12,10 @@ Method | HTTP request | Description [**update_collection_binaries**](CollectionsApi.md#update_collection_binaries) | **PATCH** /v2/collections/{collection_id}/binaries | Updates a collection binaries [**update_collection_tags**](CollectionsApi.md#update_collection_tags) | **PATCH** /v2/collections/{collection_id}/tags | Updates a collection tags [**v3_create_collection**](CollectionsApi.md#v3_create_collection) | **POST** /v3/collections | Create a collection. +[**v3_delete_collection**](CollectionsApi.md#v3_delete_collection) | **DELETE** /v3/collections/{collection_id} | Delete a collection. [**v3_get_collection**](CollectionsApi.md#v3_get_collection) | **GET** /v3/collections/{collection_id} | Get a collection. [**v3_list_collections**](CollectionsApi.md#v3_list_collections) | **GET** /v3/collections | List collections. +[**v3_patch_collection**](CollectionsApi.md#v3_patch_collection) | **PATCH** /v3/collections/{collection_id} | Update a collection. [**v3_patch_collection_binaries**](CollectionsApi.md#v3_patch_collection_binaries) | **PATCH** /v3/collections/{collection_id}/binaries | Replace the binaries in a collection. [**v3_patch_collection_tags**](CollectionsApi.md#v3_patch_collection_tags) | **PATCH** /v3/collections/{collection_id}/tags | Replace the tags on a collection. @@ -698,6 +700,92 @@ 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) +# **v3_delete_collection** +> v3_delete_collection(collection_id) + +Delete a collection. + +Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied +- `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +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.CollectionsApi(api_client) + collection_id = 56 # int | + + try: + # Delete a collection. + api_instance.v3_delete_collection(collection_id) + except Exception as e: + print("Exception when calling CollectionsApi->v3_delete_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection_id** | **int**| | + +### Return type + +void (empty response body) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | No Content | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**409** | Conflict | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[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) + # **v3_get_collection** > GetCollectionOutputBody v3_get_collection(collection_id, include_tags=include_tags, include_binaries=include_binaries, page_size=page_size, page_number=page_number, binary_search_str=binary_search_str) @@ -887,6 +975,97 @@ 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) +# **v3_patch_collection** +> PatchCollectionOutputBody v3_patch_collection(collection_id, patch_collection_input_body) + +Update a collection. + +Updates a collection's name, description, and/or scope. Omitted fields keep their existing values. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied +- `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.patch_collection_input_body import PatchCollectionInputBody +from revengai.models.patch_collection_output_body import PatchCollectionOutputBody +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.CollectionsApi(api_client) + collection_id = 56 # int | + patch_collection_input_body = revengai.PatchCollectionInputBody() # PatchCollectionInputBody | + + try: + # Update a collection. + api_response = api_instance.v3_patch_collection(collection_id, patch_collection_input_body) + print("The response of CollectionsApi->v3_patch_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionsApi->v3_patch_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection_id** | **int**| | + **patch_collection_input_body** | [**PatchCollectionInputBody**](PatchCollectionInputBody.md)| | + +### Return type + +[**PatchCollectionOutputBody**](PatchCollectionOutputBody.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** | OK | - | +**403** | Forbidden | - | +**404** | Not Found | - | +**422** | Unprocessable Entity | - | +**500** | Internal Server Error | - | + +[[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) + # **v3_patch_collection_binaries** > PatchCollectionBinariesOutputBody v3_patch_collection_binaries(collection_id, patch_collection_binaries_input_body) diff --git a/docs/PatchCollectionInputBody.md b/docs/PatchCollectionInputBody.md new file mode 100644 index 0000000..d2b1cb9 --- /dev/null +++ b/docs/PatchCollectionInputBody.md @@ -0,0 +1,31 @@ +# PatchCollectionInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collection_name** | **str** | New collection name. Omit, null, or empty string to keep existing. | [optional] +**collection_scope** | **str** | New scope (PUBLIC, PRIVATE, PROTECTED, TEAM). Omit or send null to keep existing. Empty string returns 422 UNPROCESSABLE ENTITY. | [optional] +**description** | **str** | New description. Omit, null, or empty string to keep existing. | [optional] + +## Example + +```python +from revengai.models.patch_collection_input_body import PatchCollectionInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of PatchCollectionInputBody from a JSON string +patch_collection_input_body_instance = PatchCollectionInputBody.from_json(json) +# print the JSON string representation of the object +print(PatchCollectionInputBody.to_json()) + +# convert the object into a dict +patch_collection_input_body_dict = patch_collection_input_body_instance.to_dict() +# create an instance of PatchCollectionInputBody from a dict +patch_collection_input_body_from_dict = PatchCollectionInputBody.from_dict(patch_collection_input_body_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/PatchCollectionOutputBody.md b/docs/PatchCollectionOutputBody.md new file mode 100644 index 0000000..746e860 --- /dev/null +++ b/docs/PatchCollectionOutputBody.md @@ -0,0 +1,38 @@ +# PatchCollectionOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**binary_count** | **int** | | +**collection_id** | **int** | | +**collection_name** | **str** | | +**collection_scope** | **str** | | +**created_at** | **datetime** | | +**description** | **str** | | +**model_id** | **int** | | +**team_id** | **int** | | +**updated_at** | **datetime** | | +**user_id** | **int** | | + +## Example + +```python +from revengai.models.patch_collection_output_body import PatchCollectionOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of PatchCollectionOutputBody from a JSON string +patch_collection_output_body_instance = PatchCollectionOutputBody.from_json(json) +# print the JSON string representation of the object +print(PatchCollectionOutputBody.to_json()) + +# convert the object into a dict +patch_collection_output_body_dict = patch_collection_output_body_instance.to_dict() +# create an instance of PatchCollectionOutputBody from a dict +patch_collection_output_body_from_dict = PatchCollectionOutputBody.from_dict(patch_collection_output_body_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/TokenisedData.md b/docs/TokenisedData.md index ed14821..d05c88d 100644 --- a/docs/TokenisedData.md +++ b/docs/TokenisedData.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**function_mapping** | [**FunctionMapping**](FunctionMapping.md) | Complete mapping data for token resolution | [optional] +**function_mapping** | [**AIDecompFunctionMapping**](AIDecompFunctionMapping.md) | Complete mapping data for token resolution | [optional] **predicted_function_name** | **str** | Predicted function name from the AI model | [optional] **status** | **str** | Task status | **tokenised_decompilation** | **str** | Source code with placeholder tokens | [optional] diff --git a/revengai/__init__.py b/revengai/__init__.py index 46ca088..1642198 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.92.0" +__version__ = "v3.93.0" # Define package exports __all__ = [ @@ -46,6 +46,9 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "AIDecompFunctionMapping", + "AIDecompInverseFunctionMapItem", + "AIDecompInverseStringMapItem", "APIError", "AddCalleeInputBody", "AddUserStringInputBody", @@ -361,6 +364,8 @@ "Params", "PatchCollectionBinariesInputBody", "PatchCollectionBinariesOutputBody", + "PatchCollectionInputBody", + "PatchCollectionOutputBody", "PatchCollectionTagsInputBody", "PatchCollectionTagsOutputBody", "PatchCommentBody", @@ -506,6 +511,9 @@ from revengai.exceptions import ApiException as ApiException # import models into sdk package +from revengai.models.ai_decomp_function_mapping import AIDecompFunctionMapping as AIDecompFunctionMapping +from revengai.models.ai_decomp_inverse_function_map_item import AIDecompInverseFunctionMapItem as AIDecompInverseFunctionMapItem +from revengai.models.ai_decomp_inverse_string_map_item import AIDecompInverseStringMapItem as AIDecompInverseStringMapItem from revengai.models.api_error import APIError as APIError from revengai.models.add_callee_input_body import AddCalleeInputBody as AddCalleeInputBody from revengai.models.add_user_string_input_body import AddUserStringInputBody as AddUserStringInputBody @@ -821,6 +829,8 @@ from revengai.models.params import Params as Params from revengai.models.patch_collection_binaries_input_body import PatchCollectionBinariesInputBody as PatchCollectionBinariesInputBody from revengai.models.patch_collection_binaries_output_body import PatchCollectionBinariesOutputBody as PatchCollectionBinariesOutputBody +from revengai.models.patch_collection_input_body import PatchCollectionInputBody as PatchCollectionInputBody +from revengai.models.patch_collection_output_body import PatchCollectionOutputBody as PatchCollectionOutputBody from revengai.models.patch_collection_tags_input_body import PatchCollectionTagsInputBody as PatchCollectionTagsInputBody from revengai.models.patch_collection_tags_output_body import PatchCollectionTagsOutputBody as PatchCollectionTagsOutputBody from revengai.models.patch_comment_body import PatchCommentBody as PatchCommentBody diff --git a/revengai/api/collections_api.py b/revengai/api/collections_api.py index c6ab9ec..e5cc9a5 100644 --- a/revengai/api/collections_api.py +++ b/revengai/api/collections_api.py @@ -36,6 +36,8 @@ from revengai.models.order import Order from revengai.models.patch_collection_binaries_input_body import PatchCollectionBinariesInputBody from revengai.models.patch_collection_binaries_output_body import PatchCollectionBinariesOutputBody +from revengai.models.patch_collection_input_body import PatchCollectionInputBody +from revengai.models.patch_collection_output_body import PatchCollectionOutputBody from revengai.models.patch_collection_tags_input_body import PatchCollectionTagsInputBody from revengai.models.patch_collection_tags_output_body import PatchCollectionTagsOutputBody @@ -74,7 +76,7 @@ def create_collection( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> BaseResponseCollectionResponse: - """Creates new collection information + """(Deprecated) Creates new collection information A collection is a group of binaries that are related in some way. This endpoint creates a new collection and allows you to add tags and binaries to it. If you add tags or binaries to the collection, they will be returned in the response. @@ -101,6 +103,7 @@ def create_collection( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("POST /v2/collections is deprecated.", DeprecationWarning) _param = self._create_collection_serialize( collection_create_request=collection_create_request, @@ -142,7 +145,7 @@ def create_collection_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[BaseResponseCollectionResponse]: - """Creates new collection information + """(Deprecated) Creates new collection information A collection is a group of binaries that are related in some way. This endpoint creates a new collection and allows you to add tags and binaries to it. If you add tags or binaries to the collection, they will be returned in the response. @@ -169,6 +172,7 @@ def create_collection_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("POST /v2/collections is deprecated.", DeprecationWarning) _param = self._create_collection_serialize( collection_create_request=collection_create_request, @@ -210,7 +214,7 @@ def create_collection_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Creates new collection information + """(Deprecated) Creates new collection information A collection is a group of binaries that are related in some way. This endpoint creates a new collection and allows you to add tags and binaries to it. If you add tags or binaries to the collection, they will be returned in the response. @@ -237,6 +241,7 @@ def create_collection_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("POST /v2/collections is deprecated.", DeprecationWarning) _param = self._create_collection_serialize( collection_create_request=collection_create_request, @@ -351,7 +356,7 @@ def delete_collection( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> BaseResponseBool: - """Deletes a collection + """(Deprecated) Deletes a collection Deletes a collection @@ -378,6 +383,7 @@ def delete_collection( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("DELETE /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._delete_collection_serialize( collection_id=collection_id, @@ -419,7 +425,7 @@ def delete_collection_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[BaseResponseBool]: - """Deletes a collection + """(Deprecated) Deletes a collection Deletes a collection @@ -446,6 +452,7 @@ def delete_collection_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("DELETE /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._delete_collection_serialize( collection_id=collection_id, @@ -487,7 +494,7 @@ def delete_collection_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Deletes a collection + """(Deprecated) Deletes a collection Deletes a collection @@ -514,6 +521,7 @@ def delete_collection_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("DELETE /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._delete_collection_serialize( collection_id=collection_id, @@ -620,7 +628,7 @@ def get_collection( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> BaseResponseCollectionResponse: - """Returns a collection + """(Deprecated) Returns a collection Gets a single collection. The collection can include binaries and tags if requested. You can specify whether to include tags and binaries in the response by using the query string parameters defined. @@ -657,6 +665,7 @@ def get_collection( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("GET /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._get_collection_serialize( collection_id=collection_id, @@ -708,7 +717,7 @@ def get_collection_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[BaseResponseCollectionResponse]: - """Returns a collection + """(Deprecated) Returns a collection Gets a single collection. The collection can include binaries and tags if requested. You can specify whether to include tags and binaries in the response by using the query string parameters defined. @@ -745,6 +754,7 @@ def get_collection_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("GET /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._get_collection_serialize( collection_id=collection_id, @@ -796,7 +806,7 @@ def get_collection_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Returns a collection + """(Deprecated) Returns a collection Gets a single collection. The collection can include binaries and tags if requested. You can specify whether to include tags and binaries in the response by using the query string parameters defined. @@ -833,6 +843,7 @@ def get_collection_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("GET /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._get_collection_serialize( collection_id=collection_id, @@ -969,7 +980,7 @@ def list_collections( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> BaseResponseListCollectionResults: - """Gets basic collections information + """(Deprecated) Gets basic collections information Returns a list of collections @@ -1006,6 +1017,7 @@ def list_collections( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("GET /v2/collections is deprecated.", DeprecationWarning) _param = self._list_collections_serialize( search_term=search_term, @@ -1057,7 +1069,7 @@ def list_collections_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[BaseResponseListCollectionResults]: - """Gets basic collections information + """(Deprecated) Gets basic collections information Returns a list of collections @@ -1094,6 +1106,7 @@ def list_collections_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("GET /v2/collections is deprecated.", DeprecationWarning) _param = self._list_collections_serialize( search_term=search_term, @@ -1145,7 +1158,7 @@ def list_collections_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Gets basic collections information + """(Deprecated) Gets basic collections information Returns a list of collections @@ -1182,6 +1195,7 @@ def list_collections_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("GET /v2/collections is deprecated.", DeprecationWarning) _param = self._list_collections_serialize( search_term=search_term, @@ -1317,7 +1331,7 @@ def update_collection( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> BaseResponseCollectionResponse: - """Updates a collection + """(Deprecated) Updates a collection Updates a collection, you can update the collection name, description, and scope @@ -1346,6 +1360,7 @@ def update_collection( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._update_collection_serialize( collection_id=collection_id, @@ -1389,7 +1404,7 @@ def update_collection_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[BaseResponseCollectionResponse]: - """Updates a collection + """(Deprecated) Updates a collection Updates a collection, you can update the collection name, description, and scope @@ -1418,6 +1433,7 @@ def update_collection_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._update_collection_serialize( collection_id=collection_id, @@ -1461,7 +1477,7 @@ def update_collection_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Updates a collection + """(Deprecated) Updates a collection Updates a collection, you can update the collection name, description, and scope @@ -1490,6 +1506,7 @@ def update_collection_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id} is deprecated.", DeprecationWarning) _param = self._update_collection_serialize( collection_id=collection_id, @@ -1609,7 +1626,7 @@ def update_collection_binaries( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> BaseResponseCollectionBinariesUpdateResponse: - """Updates a collection binaries + """(Deprecated) Updates a collection binaries Updates/changes a collection binaries to whatever is provided in the request. After this update the collection will only contain the binaries provided in the request. @@ -1638,6 +1655,7 @@ def update_collection_binaries( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id}/binaries is deprecated.", DeprecationWarning) _param = self._update_collection_binaries_serialize( collection_id=collection_id, @@ -1681,7 +1699,7 @@ def update_collection_binaries_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[BaseResponseCollectionBinariesUpdateResponse]: - """Updates a collection binaries + """(Deprecated) Updates a collection binaries Updates/changes a collection binaries to whatever is provided in the request. After this update the collection will only contain the binaries provided in the request. @@ -1710,6 +1728,7 @@ def update_collection_binaries_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id}/binaries is deprecated.", DeprecationWarning) _param = self._update_collection_binaries_serialize( collection_id=collection_id, @@ -1753,7 +1772,7 @@ def update_collection_binaries_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Updates a collection binaries + """(Deprecated) Updates a collection binaries Updates/changes a collection binaries to whatever is provided in the request. After this update the collection will only contain the binaries provided in the request. @@ -1782,6 +1801,7 @@ def update_collection_binaries_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id}/binaries is deprecated.", DeprecationWarning) _param = self._update_collection_binaries_serialize( collection_id=collection_id, @@ -1901,7 +1921,7 @@ def update_collection_tags( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> BaseResponseCollectionTagsUpdateResponse: - """Updates a collection tags + """(Deprecated) Updates a collection tags Updates/changes a collection tags to whatever is provided in the request. After this update the collection will only contain the tags provided in the request. @@ -1930,6 +1950,7 @@ def update_collection_tags( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id}/tags is deprecated.", DeprecationWarning) _param = self._update_collection_tags_serialize( collection_id=collection_id, @@ -1973,7 +1994,7 @@ def update_collection_tags_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[BaseResponseCollectionTagsUpdateResponse]: - """Updates a collection tags + """(Deprecated) Updates a collection tags Updates/changes a collection tags to whatever is provided in the request. After this update the collection will only contain the tags provided in the request. @@ -2002,6 +2023,7 @@ def update_collection_tags_with_http_info( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id}/tags is deprecated.", DeprecationWarning) _param = self._update_collection_tags_serialize( collection_id=collection_id, @@ -2045,7 +2067,7 @@ def update_collection_tags_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Updates a collection tags + """(Deprecated) Updates a collection tags Updates/changes a collection tags to whatever is provided in the request. After this update the collection will only contain the tags provided in the request. @@ -2074,6 +2096,7 @@ def update_collection_tags_without_preload_content( :type _host_index: int, optional :return: Returns the result object. """ # noqa: E501 + warnings.warn("PATCH /v2/collections/{collection_id}/tags is deprecated.", DeprecationWarning) _param = self._update_collection_tags_serialize( collection_id=collection_id, @@ -2458,6 +2481,282 @@ def _v3_create_collection_serialize( + @validate_call + def v3_delete_collection( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + _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, + ) -> None: + """Delete a collection. + + Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + + :param collection_id: (required) + :type collection_id: int + :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._v3_delete_collection_serialize( + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "APIError", + '404': "APIError", + '409': "APIError", + '422': "APIError", + '500': "APIError", + } + 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 v3_delete_collection_with_http_info( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + _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[None]: + """Delete a collection. + + Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + + :param collection_id: (required) + :type collection_id: int + :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._v3_delete_collection_serialize( + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "APIError", + '404': "APIError", + '409': "APIError", + '422': "APIError", + '500': "APIError", + } + 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 v3_delete_collection_without_preload_content( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + _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: + """Delete a collection. + + Deletes a collection. The collection must not have any linked binaries (call PATCH /v3/collections/{collection_id}/binaries with an empty list first). **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `409` [`CONFLICT`](/errors/CONFLICT) — Conflict + + :param collection_id: (required) + :type collection_id: int + :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._v3_delete_collection_serialize( + collection_id=collection_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '403': "APIError", + '404': "APIError", + '409': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_delete_collection_serialize( + self, + collection_id, + _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 + if collection_id is not None: + _path_params['collection_id'] = collection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/v3/collections/{collection_id}', + 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 v3_get_collection( self, @@ -3168,6 +3467,307 @@ def _v3_list_collections_serialize( + @validate_call + def v3_patch_collection( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_input_body: PatchCollectionInputBody, + _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, + ) -> PatchCollectionOutputBody: + """Update a collection. + + Updates a collection's name, description, and/or scope. Omitted fields keep their existing values. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + + :param collection_id: (required) + :type collection_id: int + :param patch_collection_input_body: (required) + :type patch_collection_input_body: PatchCollectionInputBody + :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._v3_patch_collection_serialize( + collection_id=collection_id, + patch_collection_input_body=patch_collection_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + 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 v3_patch_collection_with_http_info( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_input_body: PatchCollectionInputBody, + _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[PatchCollectionOutputBody]: + """Update a collection. + + Updates a collection's name, description, and/or scope. Omitted fields keep their existing values. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + + :param collection_id: (required) + :type collection_id: int + :param patch_collection_input_body: (required) + :type patch_collection_input_body: PatchCollectionInputBody + :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._v3_patch_collection_serialize( + collection_id=collection_id, + patch_collection_input_body=patch_collection_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + 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 v3_patch_collection_without_preload_content( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_input_body: PatchCollectionInputBody, + _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: + """Update a collection. + + Updates a collection's name, description, and/or scope. Omitted fields keep their existing values. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + + :param collection_id: (required) + :type collection_id: int + :param patch_collection_input_body: (required) + :type patch_collection_input_body: PatchCollectionInputBody + :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._v3_patch_collection_serialize( + collection_id=collection_id, + patch_collection_input_body=patch_collection_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionOutputBody", + '403': "APIError", + '404': "APIError", + '422': "APIError", + '500': "APIError", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _v3_patch_collection_serialize( + self, + collection_id, + patch_collection_input_body, + _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 + if collection_id is not None: + _path_params['collection_id'] = collection_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if patch_collection_input_body is not None: + _body_params = patch_collection_input_body + + + # 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='/v3/collections/{collection_id}', + 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 v3_patch_collection_binaries( self, diff --git a/revengai/api_client.py b/revengai/api_client.py index 347c18e..89007e3 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.92.0/python' + self.user_agent = 'OpenAPI-Generator/v3.93.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index df13518..3373189 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.92.0\n"\ - "SDK Package Version: v3.92.0".\ + "Version of the API: v3.93.0\n"\ + "SDK Package Version: v3.93.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 06556e3..2eab098 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -12,6 +12,9 @@ """ # noqa: E501 # import models into model package +from revengai.models.ai_decomp_function_mapping import AIDecompFunctionMapping +from revengai.models.ai_decomp_inverse_function_map_item import AIDecompInverseFunctionMapItem +from revengai.models.ai_decomp_inverse_string_map_item import AIDecompInverseStringMapItem from revengai.models.api_error import APIError from revengai.models.add_callee_input_body import AddCalleeInputBody from revengai.models.add_user_string_input_body import AddUserStringInputBody @@ -327,6 +330,8 @@ from revengai.models.params import Params from revengai.models.patch_collection_binaries_input_body import PatchCollectionBinariesInputBody from revengai.models.patch_collection_binaries_output_body import PatchCollectionBinariesOutputBody +from revengai.models.patch_collection_input_body import PatchCollectionInputBody +from revengai.models.patch_collection_output_body import PatchCollectionOutputBody from revengai.models.patch_collection_tags_input_body import PatchCollectionTagsInputBody from revengai.models.patch_collection_tags_output_body import PatchCollectionTagsOutputBody from revengai.models.patch_comment_body import PatchCommentBody diff --git a/revengai/models/ai_decomp_function_mapping.py b/revengai/models/ai_decomp_function_mapping.py new file mode 100644 index 0000000..7cb55f2 --- /dev/null +++ b/revengai/models/ai_decomp_function_mapping.py @@ -0,0 +1,290 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + 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, StrictStr +from typing import Any, ClassVar, Dict, List +from revengai.models.ai_decomp_inverse_function_map_item import AIDecompInverseFunctionMapItem +from revengai.models.ai_decomp_inverse_string_map_item import AIDecompInverseStringMapItem +from revengai.models.replacement_value import ReplacementValue +from typing import Optional, Set +from typing_extensions import Self + +class AIDecompFunctionMapping(BaseModel): + """ + AIDecompFunctionMapping + """ # noqa: E501 + fields: Dict[str, Dict[str, ReplacementValue]] + inverse_function_map: Dict[str, AIDecompInverseFunctionMapItem] + inverse_string_map: Dict[str, AIDecompInverseStringMapItem] + unmatched_custom_function_pointers: Dict[str, ReplacementValue] + unmatched_custom_types: Dict[str, ReplacementValue] + unmatched_enums: Dict[str, ReplacementValue] + unmatched_external_vars: Dict[str, ReplacementValue] + unmatched_functions: Dict[str, ReplacementValue] + unmatched_global_vars: Dict[str, ReplacementValue] + unmatched_go_to_labels: Dict[str, ReplacementValue] + unmatched_strings: Dict[str, ReplacementValue] + unmatched_variadic_lists: Dict[str, ReplacementValue] + unmatched_vars: Dict[str, ReplacementValue] + user_override_mappings: Dict[str, StrictStr] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["fields", "inverse_function_map", "inverse_string_map", "unmatched_custom_function_pointers", "unmatched_custom_types", "unmatched_enums", "unmatched_external_vars", "unmatched_functions", "unmatched_global_vars", "unmatched_go_to_labels", "unmatched_strings", "unmatched_variadic_lists", "unmatched_vars", "user_override_mappings"] + + 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 AIDecompFunctionMapping 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. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _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 value in fields (dict) + _field_dict = {} + if self.fields: + for _key_fields in self.fields: + if self.fields[_key_fields]: + _field_dict[_key_fields] = self.fields[_key_fields].to_dict() + _dict['fields'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in inverse_function_map (dict) + _field_dict = {} + if self.inverse_function_map: + for _key_inverse_function_map in self.inverse_function_map: + if self.inverse_function_map[_key_inverse_function_map]: + _field_dict[_key_inverse_function_map] = self.inverse_function_map[_key_inverse_function_map].to_dict() + _dict['inverse_function_map'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in inverse_string_map (dict) + _field_dict = {} + if self.inverse_string_map: + for _key_inverse_string_map in self.inverse_string_map: + if self.inverse_string_map[_key_inverse_string_map]: + _field_dict[_key_inverse_string_map] = self.inverse_string_map[_key_inverse_string_map].to_dict() + _dict['inverse_string_map'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_custom_function_pointers (dict) + _field_dict = {} + if self.unmatched_custom_function_pointers: + for _key_unmatched_custom_function_pointers in self.unmatched_custom_function_pointers: + if self.unmatched_custom_function_pointers[_key_unmatched_custom_function_pointers]: + _field_dict[_key_unmatched_custom_function_pointers] = self.unmatched_custom_function_pointers[_key_unmatched_custom_function_pointers].to_dict() + _dict['unmatched_custom_function_pointers'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_custom_types (dict) + _field_dict = {} + if self.unmatched_custom_types: + for _key_unmatched_custom_types in self.unmatched_custom_types: + if self.unmatched_custom_types[_key_unmatched_custom_types]: + _field_dict[_key_unmatched_custom_types] = self.unmatched_custom_types[_key_unmatched_custom_types].to_dict() + _dict['unmatched_custom_types'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_enums (dict) + _field_dict = {} + if self.unmatched_enums: + for _key_unmatched_enums in self.unmatched_enums: + if self.unmatched_enums[_key_unmatched_enums]: + _field_dict[_key_unmatched_enums] = self.unmatched_enums[_key_unmatched_enums].to_dict() + _dict['unmatched_enums'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_external_vars (dict) + _field_dict = {} + if self.unmatched_external_vars: + for _key_unmatched_external_vars in self.unmatched_external_vars: + if self.unmatched_external_vars[_key_unmatched_external_vars]: + _field_dict[_key_unmatched_external_vars] = self.unmatched_external_vars[_key_unmatched_external_vars].to_dict() + _dict['unmatched_external_vars'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_functions (dict) + _field_dict = {} + if self.unmatched_functions: + for _key_unmatched_functions in self.unmatched_functions: + if self.unmatched_functions[_key_unmatched_functions]: + _field_dict[_key_unmatched_functions] = self.unmatched_functions[_key_unmatched_functions].to_dict() + _dict['unmatched_functions'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_global_vars (dict) + _field_dict = {} + if self.unmatched_global_vars: + for _key_unmatched_global_vars in self.unmatched_global_vars: + if self.unmatched_global_vars[_key_unmatched_global_vars]: + _field_dict[_key_unmatched_global_vars] = self.unmatched_global_vars[_key_unmatched_global_vars].to_dict() + _dict['unmatched_global_vars'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_go_to_labels (dict) + _field_dict = {} + if self.unmatched_go_to_labels: + for _key_unmatched_go_to_labels in self.unmatched_go_to_labels: + if self.unmatched_go_to_labels[_key_unmatched_go_to_labels]: + _field_dict[_key_unmatched_go_to_labels] = self.unmatched_go_to_labels[_key_unmatched_go_to_labels].to_dict() + _dict['unmatched_go_to_labels'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_strings (dict) + _field_dict = {} + if self.unmatched_strings: + for _key_unmatched_strings in self.unmatched_strings: + if self.unmatched_strings[_key_unmatched_strings]: + _field_dict[_key_unmatched_strings] = self.unmatched_strings[_key_unmatched_strings].to_dict() + _dict['unmatched_strings'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_variadic_lists (dict) + _field_dict = {} + if self.unmatched_variadic_lists: + for _key_unmatched_variadic_lists in self.unmatched_variadic_lists: + if self.unmatched_variadic_lists[_key_unmatched_variadic_lists]: + _field_dict[_key_unmatched_variadic_lists] = self.unmatched_variadic_lists[_key_unmatched_variadic_lists].to_dict() + _dict['unmatched_variadic_lists'] = _field_dict + # override the default output from pydantic by calling `to_dict()` of each value in unmatched_vars (dict) + _field_dict = {} + if self.unmatched_vars: + for _key_unmatched_vars in self.unmatched_vars: + if self.unmatched_vars[_key_unmatched_vars]: + _field_dict[_key_unmatched_vars] = self.unmatched_vars[_key_unmatched_vars].to_dict() + _dict['unmatched_vars'] = _field_dict + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AIDecompFunctionMapping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fields": dict( + (_k, dict( + (_ik, ReplacementValue.from_dict(_iv)) + for _ik, _iv in _v.items() + ) + if _v is not None + else None + ) + for _k, _v in obj.get("fields").items() + ) + if obj.get("fields") is not None + else None, + "inverse_function_map": dict( + (_k, AIDecompInverseFunctionMapItem.from_dict(_v)) + for _k, _v in obj["inverse_function_map"].items() + ) + if obj.get("inverse_function_map") is not None + else None, + "inverse_string_map": dict( + (_k, AIDecompInverseStringMapItem.from_dict(_v)) + for _k, _v in obj["inverse_string_map"].items() + ) + if obj.get("inverse_string_map") is not None + else None, + "unmatched_custom_function_pointers": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_custom_function_pointers"].items() + ) + if obj.get("unmatched_custom_function_pointers") is not None + else None, + "unmatched_custom_types": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_custom_types"].items() + ) + if obj.get("unmatched_custom_types") is not None + else None, + "unmatched_enums": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_enums"].items() + ) + if obj.get("unmatched_enums") is not None + else None, + "unmatched_external_vars": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_external_vars"].items() + ) + if obj.get("unmatched_external_vars") is not None + else None, + "unmatched_functions": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_functions"].items() + ) + if obj.get("unmatched_functions") is not None + else None, + "unmatched_global_vars": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_global_vars"].items() + ) + if obj.get("unmatched_global_vars") is not None + else None, + "unmatched_go_to_labels": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_go_to_labels"].items() + ) + if obj.get("unmatched_go_to_labels") is not None + else None, + "unmatched_strings": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_strings"].items() + ) + if obj.get("unmatched_strings") is not None + else None, + "unmatched_variadic_lists": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_variadic_lists"].items() + ) + if obj.get("unmatched_variadic_lists") is not None + else None, + "unmatched_vars": dict( + (_k, ReplacementValue.from_dict(_v)) + for _k, _v in obj["unmatched_vars"].items() + ) + if obj.get("unmatched_vars") is not None + else None, + "user_override_mappings": obj.get("user_override_mappings") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/ai_decomp_inverse_function_map_item.py b/revengai/models/ai_decomp_inverse_function_map_item.py new file mode 100644 index 0000000..97632a1 --- /dev/null +++ b/revengai/models/ai_decomp_inverse_function_map_item.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + 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, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List +from revengai.models.numeric_addr import NumericAddr +from typing import Optional, Set +from typing_extensions import Self + +class AIDecompInverseFunctionMapItem(BaseModel): + """ + AIDecompInverseFunctionMapItem + """ # noqa: E501 + addr: NumericAddr + is_external: StrictBool + name: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["addr", "is_external", "name"] + + 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 AIDecompInverseFunctionMapItem 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. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of addr + if self.addr: + _dict['addr'] = self.addr.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AIDecompInverseFunctionMapItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "addr": NumericAddr.from_dict(obj["addr"]) if obj.get("addr") is not None else None, + "is_external": obj.get("is_external"), + "name": obj.get("name") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/ai_decomp_inverse_string_map_item.py b/revengai/models/ai_decomp_inverse_string_map_item.py new file mode 100644 index 0000000..63330fa --- /dev/null +++ b/revengai/models/ai_decomp_inverse_string_map_item.py @@ -0,0 +1,105 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + 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, StrictStr +from typing import Any, ClassVar, Dict, List +from revengai.models.numeric_addr import NumericAddr +from typing import Optional, Set +from typing_extensions import Self + +class AIDecompInverseStringMapItem(BaseModel): + """ + AIDecompInverseStringMapItem + """ # noqa: E501 + addr: NumericAddr + string: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["addr", "string"] + + 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 AIDecompInverseStringMapItem 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. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of addr + if self.addr: + _dict['addr'] = self.addr.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AIDecompInverseStringMapItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "addr": NumericAddr.from_dict(obj["addr"]) if obj.get("addr") is not None else None, + "string": obj.get("string") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/patch_collection_input_body.py b/revengai/models/patch_collection_input_body.py new file mode 100644 index 0000000..f8de91d --- /dev/null +++ b/revengai/models/patch_collection_input_body.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PatchCollectionInputBody(BaseModel): + """ + PatchCollectionInputBody + """ # noqa: E501 + collection_name: Optional[StrictStr] = Field(default=None, description="New collection name. Omit, null, or empty string to keep existing.") + collection_scope: Optional[StrictStr] = Field(default=None, description="New scope (PUBLIC, PRIVATE, PROTECTED, TEAM). Omit or send null to keep existing. Empty string returns 422 UNPROCESSABLE ENTITY.") + description: Optional[StrictStr] = Field(default=None, description="New description. Omit, null, or empty string to keep existing.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collection_name", "collection_scope", "description"] + + 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 PatchCollectionInputBody 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. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchCollectionInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collection_name": obj.get("collection_name"), + "collection_scope": obj.get("collection_scope"), + "description": obj.get("description") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/patch_collection_output_body.py b/revengai/models/patch_collection_output_body.py new file mode 100644 index 0000000..d31b044 --- /dev/null +++ b/revengai/models/patch_collection_output_body.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + RevEng.AI API + + RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal. + + 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 datetime import datetime +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 PatchCollectionOutputBody(BaseModel): + """ + PatchCollectionOutputBody + """ # noqa: E501 + binary_count: StrictInt + collection_id: StrictInt + collection_name: StrictStr + collection_scope: StrictStr + created_at: datetime + description: StrictStr + model_id: StrictInt + team_id: StrictInt + updated_at: datetime + user_id: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["binary_count", "collection_id", "collection_name", "collection_scope", "created_at", "description", "model_id", "team_id", "updated_at", "user_id"] + + 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 PatchCollectionOutputBody 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. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchCollectionOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "binary_count": obj.get("binary_count"), + "collection_id": obj.get("collection_id"), + "collection_name": obj.get("collection_name"), + "collection_scope": obj.get("collection_scope"), + "created_at": obj.get("created_at"), + "description": obj.get("description"), + "model_id": obj.get("model_id"), + "team_id": obj.get("team_id"), + "updated_at": obj.get("updated_at"), + "user_id": obj.get("user_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/revengai/models/replacement_value.py b/revengai/models/replacement_value.py index 7f7a0de..6d2fc02 100644 --- a/revengai/models/replacement_value.py +++ b/revengai/models/replacement_value.py @@ -17,7 +17,7 @@ import json from pydantic import BaseModel, ConfigDict, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self @@ -25,7 +25,7 @@ class ReplacementValue(BaseModel): """ ReplacementValue """ # noqa: E501 - value: Optional[StrictStr] + value: StrictStr additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["value"] @@ -75,11 +75,6 @@ def to_dict(self) -> Dict[str, Any]: for _key, _value in self.additional_properties.items(): _dict[_key] = _value - # set to None if value (nullable) is None - # and model_fields_set contains the field - if self.value is None and "value" in self.model_fields_set: - _dict['value'] = None - return _dict @classmethod diff --git a/revengai/models/tokenised_data.py b/revengai/models/tokenised_data.py index 05f8f03..f42ddbd 100644 --- a/revengai/models/tokenised_data.py +++ b/revengai/models/tokenised_data.py @@ -18,7 +18,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from revengai.models.function_mapping import FunctionMapping +from revengai.models.ai_decomp_function_mapping import AIDecompFunctionMapping from typing import Optional, Set from typing_extensions import Self @@ -26,7 +26,7 @@ class TokenisedData(BaseModel): """ TokenisedData """ # noqa: E501 - function_mapping: Optional[FunctionMapping] = Field(default=None, description="Complete mapping data for token resolution") + function_mapping: Optional[AIDecompFunctionMapping] = Field(default=None, description="Complete mapping data for token resolution") predicted_function_name: Optional[StrictStr] = Field(default=None, description="Predicted function name from the AI model") status: StrictStr = Field(description="Task status") tokenised_decompilation: Optional[StrictStr] = Field(default=None, description="Source code with placeholder tokens") @@ -101,7 +101,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "function_mapping": FunctionMapping.from_dict(obj["function_mapping"]) if obj.get("function_mapping") is not None else None, + "function_mapping": AIDecompFunctionMapping.from_dict(obj["function_mapping"]) if obj.get("function_mapping") is not None else None, "predicted_function_name": obj.get("predicted_function_name"), "status": obj.get("status"), "tokenised_decompilation": obj.get("tokenised_decompilation")