diff --git a/.sdk-version b/.sdk-version index a12e6bf..3a74886 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.91.1 +v3.92.0 diff --git a/README.md b/README.md index f7b9dc7..75c4618 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ Class | Method | HTTP request | Description *CollectionsApi* | [**v3_create_collection**](docs/CollectionsApi.md#v3_create_collection) | **POST** /v3/collections | Create 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_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 *ConversationsApi* | [**cancel_run**](docs/ConversationsApi.md#cancel_run) | **POST** /v2/conversations/{id}/cancel | Cancel an active run *ConversationsApi* | [**confirm_tool**](docs/ConversationsApi.md#confirm_tool) | **POST** /v2/conversations/{id}/confirm | Approve or reject a pending tool confirmation @@ -498,6 +500,10 @@ Class | Method | HTTP request | Description - [PEModel](docs/PEModel.md) - [PaginationModel](docs/PaginationModel.md) - [Params](docs/Params.md) + - [PatchCollectionBinariesInputBody](docs/PatchCollectionBinariesInputBody.md) + - [PatchCollectionBinariesOutputBody](docs/PatchCollectionBinariesOutputBody.md) + - [PatchCollectionTagsInputBody](docs/PatchCollectionTagsInputBody.md) + - [PatchCollectionTagsOutputBody](docs/PatchCollectionTagsOutputBody.md) - [PatchCommentBody](docs/PatchCommentBody.md) - [Platform](docs/Platform.md) - [PriceOutput](docs/PriceOutput.md) diff --git a/docs/CollectionsApi.md b/docs/CollectionsApi.md index a5a7fdc..de88635 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -14,6 +14,8 @@ Method | HTTP request | Description [**v3_create_collection**](CollectionsApi.md#v3_create_collection) | **POST** /v3/collections | Create 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_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. # **create_collection** @@ -885,3 +887,184 @@ 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_binaries** +> PatchCollectionBinariesOutputBody v3_patch_collection_binaries(collection_id, patch_collection_binaries_input_body) + +Replace the binaries in a collection. + +Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. + +**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_binaries_input_body import PatchCollectionBinariesInputBody +from revengai.models.patch_collection_binaries_output_body import PatchCollectionBinariesOutputBody +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_binaries_input_body = revengai.PatchCollectionBinariesInputBody() # PatchCollectionBinariesInputBody | + + try: + # Replace the binaries in a collection. + api_response = api_instance.v3_patch_collection_binaries(collection_id, patch_collection_binaries_input_body) + print("The response of CollectionsApi->v3_patch_collection_binaries:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionsApi->v3_patch_collection_binaries: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection_id** | **int**| | + **patch_collection_binaries_input_body** | [**PatchCollectionBinariesInputBody**](PatchCollectionBinariesInputBody.md)| | + +### Return type + +[**PatchCollectionBinariesOutputBody**](PatchCollectionBinariesOutputBody.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_tags** +> PatchCollectionTagsOutputBody v3_patch_collection_tags(collection_id, patch_collection_tags_input_body) + +Replace the tags on a collection. + +Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.patch_collection_tags_input_body import PatchCollectionTagsInputBody +from revengai.models.patch_collection_tags_output_body import PatchCollectionTagsOutputBody +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_tags_input_body = revengai.PatchCollectionTagsInputBody() # PatchCollectionTagsInputBody | + + try: + # Replace the tags on a collection. + api_response = api_instance.v3_patch_collection_tags(collection_id, patch_collection_tags_input_body) + print("The response of CollectionsApi->v3_patch_collection_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionsApi->v3_patch_collection_tags: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection_id** | **int**| | + **patch_collection_tags_input_body** | [**PatchCollectionTagsInputBody**](PatchCollectionTagsInputBody.md)| | + +### Return type + +[**PatchCollectionTagsOutputBody**](PatchCollectionTagsOutputBody.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) + diff --git a/docs/PatchCollectionBinariesInputBody.md b/docs/PatchCollectionBinariesInputBody.md new file mode 100644 index 0000000..531e255 --- /dev/null +++ b/docs/PatchCollectionBinariesInputBody.md @@ -0,0 +1,29 @@ +# PatchCollectionBinariesInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**binaries** | **List[int]** | Binary IDs to set on the collection. The collection's binaries are fully replaced with this list. | + +## Example + +```python +from revengai.models.patch_collection_binaries_input_body import PatchCollectionBinariesInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of PatchCollectionBinariesInputBody from a JSON string +patch_collection_binaries_input_body_instance = PatchCollectionBinariesInputBody.from_json(json) +# print the JSON string representation of the object +print(PatchCollectionBinariesInputBody.to_json()) + +# convert the object into a dict +patch_collection_binaries_input_body_dict = patch_collection_binaries_input_body_instance.to_dict() +# create an instance of PatchCollectionBinariesInputBody from a dict +patch_collection_binaries_input_body_from_dict = PatchCollectionBinariesInputBody.from_dict(patch_collection_binaries_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/PatchCollectionBinariesOutputBody.md b/docs/PatchCollectionBinariesOutputBody.md new file mode 100644 index 0000000..8174691 --- /dev/null +++ b/docs/PatchCollectionBinariesOutputBody.md @@ -0,0 +1,29 @@ +# PatchCollectionBinariesOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**binaries** | [**List[Binary]**](Binary.md) | | + +## Example + +```python +from revengai.models.patch_collection_binaries_output_body import PatchCollectionBinariesOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of PatchCollectionBinariesOutputBody from a JSON string +patch_collection_binaries_output_body_instance = PatchCollectionBinariesOutputBody.from_json(json) +# print the JSON string representation of the object +print(PatchCollectionBinariesOutputBody.to_json()) + +# convert the object into a dict +patch_collection_binaries_output_body_dict = patch_collection_binaries_output_body_instance.to_dict() +# create an instance of PatchCollectionBinariesOutputBody from a dict +patch_collection_binaries_output_body_from_dict = PatchCollectionBinariesOutputBody.from_dict(patch_collection_binaries_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/PatchCollectionTagsInputBody.md b/docs/PatchCollectionTagsInputBody.md new file mode 100644 index 0000000..05d114b --- /dev/null +++ b/docs/PatchCollectionTagsInputBody.md @@ -0,0 +1,29 @@ +# PatchCollectionTagsInputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tags** | **List[str]** | Tags to set on the collection. The collection's tags are fully replaced with this list. | + +## Example + +```python +from revengai.models.patch_collection_tags_input_body import PatchCollectionTagsInputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of PatchCollectionTagsInputBody from a JSON string +patch_collection_tags_input_body_instance = PatchCollectionTagsInputBody.from_json(json) +# print the JSON string representation of the object +print(PatchCollectionTagsInputBody.to_json()) + +# convert the object into a dict +patch_collection_tags_input_body_dict = patch_collection_tags_input_body_instance.to_dict() +# create an instance of PatchCollectionTagsInputBody from a dict +patch_collection_tags_input_body_from_dict = PatchCollectionTagsInputBody.from_dict(patch_collection_tags_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/PatchCollectionTagsOutputBody.md b/docs/PatchCollectionTagsOutputBody.md new file mode 100644 index 0000000..d95d094 --- /dev/null +++ b/docs/PatchCollectionTagsOutputBody.md @@ -0,0 +1,29 @@ +# PatchCollectionTagsOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**tags** | **List[str]** | | + +## Example + +```python +from revengai.models.patch_collection_tags_output_body import PatchCollectionTagsOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of PatchCollectionTagsOutputBody from a JSON string +patch_collection_tags_output_body_instance = PatchCollectionTagsOutputBody.from_json(json) +# print the JSON string representation of the object +print(PatchCollectionTagsOutputBody.to_json()) + +# convert the object into a dict +patch_collection_tags_output_body_dict = patch_collection_tags_output_body_instance.to_dict() +# create an instance of PatchCollectionTagsOutputBody from a dict +patch_collection_tags_output_body_from_dict = PatchCollectionTagsOutputBody.from_dict(patch_collection_tags_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/SearchApi.md b/docs/SearchApi.md index 6967efd..bc2dfb3 100644 --- a/docs/SearchApi.md +++ b/docs/SearchApi.md @@ -11,7 +11,7 @@ Method | HTTP request | Description # **search_binaries** -> BaseResponseBinarySearchResponse search_binaries(page=page, page_size=page_size, partial_name=partial_name, partial_sha256=partial_sha256, tags=tags, model_name=model_name, user_files_only=user_files_only) +> BaseResponseBinarySearchResponse search_binaries(page=page, page_size=page_size, partial_name=partial_name, partial_sha256=partial_sha256, tags=tags, model_name=model_name, user_files_only=user_files_only, exclude_binary_id=exclude_binary_id) Binaries search @@ -55,10 +55,11 @@ with revengai.ApiClient(configuration) as api_client: tags = ['tags_example'] # List[str] | The tags to be searched for (optional) model_name = 'model_name_example' # str | The name of the model used to analyze the binary the function belongs to (optional) user_files_only = False # bool | Whether to only search user's uploaded files (optional) (default to False) + exclude_binary_id = 56 # int | A binary ID to exclude from the results (optional) try: # Binaries search - api_response = api_instance.search_binaries(page=page, page_size=page_size, partial_name=partial_name, partial_sha256=partial_sha256, tags=tags, model_name=model_name, user_files_only=user_files_only) + api_response = api_instance.search_binaries(page=page, page_size=page_size, partial_name=partial_name, partial_sha256=partial_sha256, tags=tags, model_name=model_name, user_files_only=user_files_only, exclude_binary_id=exclude_binary_id) print("The response of SearchApi->search_binaries:\n") pprint(api_response) except Exception as e: @@ -79,6 +80,7 @@ Name | Type | Description | Notes **tags** | [**List[str]**](str.md)| The tags to be searched for | [optional] **model_name** | **str**| The name of the model used to analyze the binary the function belongs to | [optional] **user_files_only** | **bool**| Whether to only search user's uploaded files | [optional] [default to False] + **exclude_binary_id** | **int**| A binary ID to exclude from the results | [optional] ### Return type diff --git a/revengai/__init__.py b/revengai/__init__.py index 5b8d9f1..46ca088 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.91.1" +__version__ = "v3.92.0" # Define package exports __all__ = [ @@ -359,6 +359,10 @@ "PEModel", "PaginationModel", "Params", + "PatchCollectionBinariesInputBody", + "PatchCollectionBinariesOutputBody", + "PatchCollectionTagsInputBody", + "PatchCollectionTagsOutputBody", "PatchCommentBody", "Platform", "PriceOutput", @@ -815,6 +819,10 @@ from revengai.models.pe_model import PEModel as PEModel from revengai.models.pagination_model import PaginationModel as PaginationModel 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_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 from revengai.models.platform import Platform as Platform from revengai.models.price_output import PriceOutput as PriceOutput diff --git a/revengai/api/collections_api.py b/revengai/api/collections_api.py index 8ae458f..c6ab9ec 100644 --- a/revengai/api/collections_api.py +++ b/revengai/api/collections_api.py @@ -34,6 +34,10 @@ from revengai.models.get_collection_output_body import GetCollectionOutputBody from revengai.models.list_collections_output_body import ListCollectionsOutputBody 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_tags_input_body import PatchCollectionTagsInputBody +from revengai.models.patch_collection_tags_output_body import PatchCollectionTagsOutputBody from revengai.api_client import ApiClient, RequestSerialized from revengai.api_response import ApiResponse @@ -3162,3 +3166,605 @@ def _v3_list_collections_serialize( ) + + + @validate_call + def v3_patch_collection_binaries( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_binaries_input_body: PatchCollectionBinariesInputBody, + _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, + ) -> PatchCollectionBinariesOutputBody: + """Replace the binaries in a collection. + + Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. **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_binaries_input_body: (required) + :type patch_collection_binaries_input_body: PatchCollectionBinariesInputBody + :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_binaries_serialize( + collection_id=collection_id, + patch_collection_binaries_input_body=patch_collection_binaries_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionBinariesOutputBody", + '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_binaries_with_http_info( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_binaries_input_body: PatchCollectionBinariesInputBody, + _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[PatchCollectionBinariesOutputBody]: + """Replace the binaries in a collection. + + Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. **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_binaries_input_body: (required) + :type patch_collection_binaries_input_body: PatchCollectionBinariesInputBody + :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_binaries_serialize( + collection_id=collection_id, + patch_collection_binaries_input_body=patch_collection_binaries_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionBinariesOutputBody", + '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_binaries_without_preload_content( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_binaries_input_body: PatchCollectionBinariesInputBody, + _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: + """Replace the binaries in a collection. + + Replaces the binaries linked to a collection with the supplied list. Binaries not present in the request are removed. All supplied binary IDs must belong to the same model as the collection. **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_binaries_input_body: (required) + :type patch_collection_binaries_input_body: PatchCollectionBinariesInputBody + :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_binaries_serialize( + collection_id=collection_id, + patch_collection_binaries_input_body=patch_collection_binaries_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionBinariesOutputBody", + '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_binaries_serialize( + self, + collection_id, + patch_collection_binaries_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_binaries_input_body is not None: + _body_params = patch_collection_binaries_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}/binaries', + 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_tags( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_tags_input_body: PatchCollectionTagsInputBody, + _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, + ) -> PatchCollectionTagsOutputBody: + """Replace the tags on a collection. + + Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param collection_id: (required) + :type collection_id: int + :param patch_collection_tags_input_body: (required) + :type patch_collection_tags_input_body: PatchCollectionTagsInputBody + :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_tags_serialize( + collection_id=collection_id, + patch_collection_tags_input_body=patch_collection_tags_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionTagsOutputBody", + '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_tags_with_http_info( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_tags_input_body: PatchCollectionTagsInputBody, + _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[PatchCollectionTagsOutputBody]: + """Replace the tags on a collection. + + Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param collection_id: (required) + :type collection_id: int + :param patch_collection_tags_input_body: (required) + :type patch_collection_tags_input_body: PatchCollectionTagsInputBody + :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_tags_serialize( + collection_id=collection_id, + patch_collection_tags_input_body=patch_collection_tags_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionTagsOutputBody", + '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_tags_without_preload_content( + self, + collection_id: Annotated[int, Field(strict=True, ge=1)], + patch_collection_tags_input_body: PatchCollectionTagsInputBody, + _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: + """Replace the tags on a collection. + + Replaces the tags on a collection with the supplied list. Tags not present in the request are removed. Empty or whitespace-only tags are filtered; duplicates are deduplicated. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied + + :param collection_id: (required) + :type collection_id: int + :param patch_collection_tags_input_body: (required) + :type patch_collection_tags_input_body: PatchCollectionTagsInputBody + :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_tags_serialize( + collection_id=collection_id, + patch_collection_tags_input_body=patch_collection_tags_input_body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PatchCollectionTagsOutputBody", + '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_tags_serialize( + self, + collection_id, + patch_collection_tags_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_tags_input_body is not None: + _body_params = patch_collection_tags_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}/tags', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/revengai/api/search_api.py b/revengai/api/search_api.py index 62451e2..1004377 100644 --- a/revengai/api/search_api.py +++ b/revengai/api/search_api.py @@ -15,7 +15,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictStr +from pydantic import Field, StrictBool, StrictInt, StrictStr from typing import List, Optional from typing_extensions import Annotated from revengai.models.app_api_rest_v2_collections_enums_order_by import AppApiRestV2CollectionsEnumsOrderBy @@ -54,6 +54,7 @@ def search_binaries( tags: Annotated[Optional[List[StrictStr]], Field(description="The tags to be searched for")] = None, model_name: Annotated[Optional[StrictStr], Field(description="The name of the model used to analyze the binary the function belongs to")] = None, user_files_only: Annotated[Optional[StrictBool], Field(description="Whether to only search user's uploaded files")] = None, + exclude_binary_id: Annotated[Optional[StrictInt], Field(description="A binary ID to exclude from the results")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -85,6 +86,8 @@ def search_binaries( :type model_name: str :param user_files_only: Whether to only search user's uploaded files :type user_files_only: bool + :param exclude_binary_id: A binary ID to exclude from the results + :type exclude_binary_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 @@ -115,6 +118,7 @@ def search_binaries( tags=tags, model_name=model_name, user_files_only=user_files_only, + exclude_binary_id=exclude_binary_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -146,6 +150,7 @@ def search_binaries_with_http_info( tags: Annotated[Optional[List[StrictStr]], Field(description="The tags to be searched for")] = None, model_name: Annotated[Optional[StrictStr], Field(description="The name of the model used to analyze the binary the function belongs to")] = None, user_files_only: Annotated[Optional[StrictBool], Field(description="Whether to only search user's uploaded files")] = None, + exclude_binary_id: Annotated[Optional[StrictInt], Field(description="A binary ID to exclude from the results")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -177,6 +182,8 @@ def search_binaries_with_http_info( :type model_name: str :param user_files_only: Whether to only search user's uploaded files :type user_files_only: bool + :param exclude_binary_id: A binary ID to exclude from the results + :type exclude_binary_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 @@ -207,6 +214,7 @@ def search_binaries_with_http_info( tags=tags, model_name=model_name, user_files_only=user_files_only, + exclude_binary_id=exclude_binary_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -238,6 +246,7 @@ def search_binaries_without_preload_content( tags: Annotated[Optional[List[StrictStr]], Field(description="The tags to be searched for")] = None, model_name: Annotated[Optional[StrictStr], Field(description="The name of the model used to analyze the binary the function belongs to")] = None, user_files_only: Annotated[Optional[StrictBool], Field(description="Whether to only search user's uploaded files")] = None, + exclude_binary_id: Annotated[Optional[StrictInt], Field(description="A binary ID to exclude from the results")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -269,6 +278,8 @@ def search_binaries_without_preload_content( :type model_name: str :param user_files_only: Whether to only search user's uploaded files :type user_files_only: bool + :param exclude_binary_id: A binary ID to exclude from the results + :type exclude_binary_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 @@ -299,6 +310,7 @@ def search_binaries_without_preload_content( tags=tags, model_name=model_name, user_files_only=user_files_only, + exclude_binary_id=exclude_binary_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -325,6 +337,7 @@ def _search_binaries_serialize( tags, model_name, user_files_only, + exclude_binary_id, _request_auth, _content_type, _headers, @@ -376,6 +389,10 @@ def _search_binaries_serialize( _query_params.append(('user_files_only', user_files_only)) + if exclude_binary_id is not None: + + _query_params.append(('exclude_binary_id', exclude_binary_id)) + # process the header parameters # process the form parameters # process the body parameter diff --git a/revengai/api_client.py b/revengai/api_client.py index d7e4035..347c18e 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.91.1/python' + self.user_agent = 'OpenAPI-Generator/v3.92.0/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index 0f9c7c0..df13518 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.91.1\n"\ - "SDK Package Version: v3.91.1".\ + "Version of the API: v3.92.0\n"\ + "SDK Package Version: v3.92.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 e2117dc..06556e3 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -325,6 +325,10 @@ from revengai.models.pe_model import PEModel from revengai.models.pagination_model import PaginationModel 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_tags_input_body import PatchCollectionTagsInputBody +from revengai.models.patch_collection_tags_output_body import PatchCollectionTagsOutputBody from revengai.models.patch_comment_body import PatchCommentBody from revengai.models.platform import Platform from revengai.models.price_output import PriceOutput diff --git a/revengai/models/patch_collection_binaries_input_body.py b/revengai/models/patch_collection_binaries_input_body.py new file mode 100644 index 0000000..b6a62d1 --- /dev/null +++ b/revengai/models/patch_collection_binaries_input_body.py @@ -0,0 +1,104 @@ +# 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, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PatchCollectionBinariesInputBody(BaseModel): + """ + PatchCollectionBinariesInputBody + """ # noqa: E501 + binaries: Optional[List[StrictInt]] = Field(description="Binary IDs to set on the collection. The collection's binaries are fully replaced with this list.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["binaries"] + + 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 PatchCollectionBinariesInputBody 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 + + # set to None if binaries (nullable) is None + # and model_fields_set contains the field + if self.binaries is None and "binaries" in self.model_fields_set: + _dict['binaries'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchCollectionBinariesInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "binaries": obj.get("binaries") + }) + # 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_binaries_output_body.py b/revengai/models/patch_collection_binaries_output_body.py new file mode 100644 index 0000000..88f492b --- /dev/null +++ b/revengai/models/patch_collection_binaries_output_body.py @@ -0,0 +1,112 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.binary import Binary +from typing import Optional, Set +from typing_extensions import Self + +class PatchCollectionBinariesOutputBody(BaseModel): + """ + PatchCollectionBinariesOutputBody + """ # noqa: E501 + binaries: Optional[List[Binary]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["binaries"] + + 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 PatchCollectionBinariesOutputBody 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 item in binaries (list) + _items = [] + if self.binaries: + for _item_binaries in self.binaries: + if _item_binaries: + _items.append(_item_binaries.to_dict()) + _dict['binaries'] = _items + # 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 + + # set to None if binaries (nullable) is None + # and model_fields_set contains the field + if self.binaries is None and "binaries" in self.model_fields_set: + _dict['binaries'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchCollectionBinariesOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "binaries": [Binary.from_dict(_item) for _item in obj["binaries"]] if obj.get("binaries") is not None else None + }) + # 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_tags_input_body.py b/revengai/models/patch_collection_tags_input_body.py new file mode 100644 index 0000000..db7f810 --- /dev/null +++ b/revengai/models/patch_collection_tags_input_body.py @@ -0,0 +1,104 @@ +# 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 PatchCollectionTagsInputBody(BaseModel): + """ + PatchCollectionTagsInputBody + """ # noqa: E501 + tags: Optional[List[StrictStr]] = Field(description="Tags to set on the collection. The collection's tags are fully replaced with this list.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["tags"] + + 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 PatchCollectionTagsInputBody 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 + + # set to None if tags (nullable) is None + # and model_fields_set contains the field + if self.tags is None and "tags" in self.model_fields_set: + _dict['tags'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchCollectionTagsInputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tags": obj.get("tags") + }) + # 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_tags_output_body.py b/revengai/models/patch_collection_tags_output_body.py new file mode 100644 index 0000000..db74657 --- /dev/null +++ b/revengai/models/patch_collection_tags_output_body.py @@ -0,0 +1,104 @@ +# 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, Optional +from typing import Optional, Set +from typing_extensions import Self + +class PatchCollectionTagsOutputBody(BaseModel): + """ + PatchCollectionTagsOutputBody + """ # noqa: E501 + tags: Optional[List[StrictStr]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["tags"] + + 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 PatchCollectionTagsOutputBody 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 + + # set to None if tags (nullable) is None + # and model_fields_set contains the field + if self.tags is None and "tags" in self.model_fields_set: + _dict['tags'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchCollectionTagsOutputBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "tags": obj.get("tags") + }) + # 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 + +