diff --git a/.sdk-version b/.sdk-version index d66c631..a12e6bf 100644 --- a/.sdk-version +++ b/.sdk-version @@ -1 +1 @@ -v3.91.0 +v3.91.1 diff --git a/README.md b/README.md index 086c86e..f7b9dc7 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,6 @@ Class | Method | HTTP request | Description *AnalysesCoreApi* | [**get_analysis_function_map**](docs/AnalysesCoreApi.md#get_analysis_function_map) | **GET** /v2/analyses/{analysis_id}/func_maps | Get Analysis Function Map *AnalysesCoreApi* | [**get_analysis_logs**](docs/AnalysesCoreApi.md#get_analysis_logs) | **GET** /v2/analyses/{analysis_id}/logs | Gets the logs of an analysis *AnalysesCoreApi* | [**get_analysis_params**](docs/AnalysesCoreApi.md#get_analysis_params) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information -*AnalysesCoreApi* | [**get_analysis_queue_position**](docs/AnalysesCoreApi.md#get_analysis_queue_position) | **GET** /v2/analyses/{analysis_id}/queue-position | Get the queue position of an analysis *AnalysesCoreApi* | [**get_analysis_status**](docs/AnalysesCoreApi.md#get_analysis_status) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis *AnalysesCoreApi* | [**insert_analysis_log**](docs/AnalysesCoreApi.md#insert_analysis_log) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis *AnalysesCoreApi* | [**list_analyses**](docs/AnalysesCoreApi.md#list_analyses) | **GET** /v2/analyses/list | Gets the most recent analyses @@ -98,13 +97,15 @@ Class | Method | HTTP request | Description *BinariesApi* | [**get_binary_related_status**](docs/BinariesApi.md#get_binary_related_status) | **GET** /v2/binaries/{binary_id}/related/status | Gets the status of the unpack binary task for a binary *BinariesApi* | [**get_related_binaries**](docs/BinariesApi.md#get_related_binaries) | **GET** /v2/binaries/{binary_id}/related | Gets the related binaries of a binary. *CollectionsApi* | [**create_collection**](docs/CollectionsApi.md#create_collection) | **POST** /v2/collections | Creates new collection information -*CollectionsApi* | [**create_collection_0**](docs/CollectionsApi.md#create_collection_0) | **POST** /v3/collections | Create a collection. *CollectionsApi* | [**delete_collection**](docs/CollectionsApi.md#delete_collection) | **DELETE** /v2/collections/{collection_id} | Deletes a collection *CollectionsApi* | [**get_collection**](docs/CollectionsApi.md#get_collection) | **GET** /v2/collections/{collection_id} | Returns a collection *CollectionsApi* | [**list_collections**](docs/CollectionsApi.md#list_collections) | **GET** /v2/collections | Gets basic collections information *CollectionsApi* | [**update_collection**](docs/CollectionsApi.md#update_collection) | **PATCH** /v2/collections/{collection_id} | Updates a collection *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_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. *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 @@ -328,6 +329,7 @@ Class | Method | HTTP request | Description - [CollectionBinaryResponse](docs/CollectionBinaryResponse.md) - [CollectionCreateRequest](docs/CollectionCreateRequest.md) - [CollectionListItem](docs/CollectionListItem.md) + - [CollectionListItemBody](docs/CollectionListItemBody.md) - [CollectionResponse](docs/CollectionResponse.md) - [CollectionResponseBinariesInner](docs/CollectionResponseBinariesInner.md) - [CollectionScope](docs/CollectionScope.md) @@ -457,6 +459,7 @@ Class | Method | HTTP request | Description - [GetAiDecompilationRatingResponse](docs/GetAiDecompilationRatingResponse.md) - [GetAiDecompilationTask](docs/GetAiDecompilationTask.md) - [GetAnalysisStringsStatusOutputBody](docs/GetAnalysisStringsStatusOutputBody.md) + - [GetCollectionOutputBody](docs/GetCollectionOutputBody.md) - [GetProductsOutputBody](docs/GetProductsOutputBody.md) - [GetPublicUserResponse](docs/GetPublicUserResponse.md) - [GetSubscriptionOutputBody](docs/GetSubscriptionOutputBody.md) @@ -474,6 +477,7 @@ Class | Method | HTTP request | Description - [InverseValue](docs/InverseValue.md) - [ListAnalysisStringsOutputBody](docs/ListAnalysisStringsOutputBody.md) - [ListCollectionResults](docs/ListCollectionResults.md) + - [ListCollectionsOutputBody](docs/ListCollectionsOutputBody.md) - [ListFunctionStringsOutputBody](docs/ListFunctionStringsOutputBody.md) - [Logs](docs/Logs.md) - [MITRETechnique](docs/MITRETechnique.md) @@ -508,7 +512,6 @@ Class | Method | HTTP request | Description - [ProgressMessage](docs/ProgressMessage.md) - [ProseEvent](docs/ProseEvent.md) - [PutAnalysisStringsRequest](docs/PutAnalysisStringsRequest.md) - - [QueuePositionResponse](docs/QueuePositionResponse.md) - [QueuedWorkflowTaskResponse](docs/QueuedWorkflowTaskResponse.md) - [ReAnalysisForm](docs/ReAnalysisForm.md) - [Recent](docs/Recent.md) diff --git a/docs/AnalysesCoreApi.md b/docs/AnalysesCoreApi.md index b4e93ea..401b52c 100644 --- a/docs/AnalysesCoreApi.md +++ b/docs/AnalysesCoreApi.md @@ -13,7 +13,6 @@ Method | HTTP request | Description [**get_analysis_function_map**](AnalysesCoreApi.md#get_analysis_function_map) | **GET** /v2/analyses/{analysis_id}/func_maps | Get Analysis Function Map [**get_analysis_logs**](AnalysesCoreApi.md#get_analysis_logs) | **GET** /v2/analyses/{analysis_id}/logs | Gets the logs of an analysis [**get_analysis_params**](AnalysesCoreApi.md#get_analysis_params) | **GET** /v2/analyses/{analysis_id}/params | Gets analysis param information -[**get_analysis_queue_position**](AnalysesCoreApi.md#get_analysis_queue_position) | **GET** /v2/analyses/{analysis_id}/queue-position | Get the queue position of an analysis [**get_analysis_status**](AnalysesCoreApi.md#get_analysis_status) | **GET** /v2/analyses/{analysis_id}/status | Gets the status of an analysis [**insert_analysis_log**](AnalysesCoreApi.md#insert_analysis_log) | **POST** /v2/analyses/{analysis_id}/logs | Insert a log entry for an analysis [**list_analyses**](AnalysesCoreApi.md#list_analyses) | **GET** /v2/analyses/list | Gets the most recent analyses @@ -778,93 +777,6 @@ 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) -# **get_analysis_queue_position** -> QueuePositionResponse get_analysis_queue_position(analysis_id) - -Get the queue position of an analysis - -Returns the number of Processing analyses with a lower analysis_id than the given one. Useful for showing the user where they sit in the processing queue while waiting for their analysis to start. - -**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.queue_position_response import QueuePositionResponse -from revengai.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://api.reveng.ai -# See configuration.py for a list of all supported configuration parameters. -configuration = revengai.Configuration( - host = "https://api.reveng.ai" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure API key authorization: APIKey -configuration.api_key['APIKey'] = os.environ["API_KEY"] - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['APIKey'] = 'Bearer' - -# Enter a context with an instance of the API client -with revengai.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = revengai.AnalysesCoreApi(api_client) - analysis_id = 56 # int | Analysis ID - - try: - # Get the queue position of an analysis - api_response = api_instance.get_analysis_queue_position(analysis_id) - print("The response of AnalysesCoreApi->get_analysis_queue_position:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling AnalysesCoreApi->get_analysis_queue_position: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **analysis_id** | **int**| Analysis ID | - -### Return type - -[**QueuePositionResponse**](QueuePositionResponse.md) - -### Authorization - -[APIKey](../README.md#APIKey) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | OK | - | -**403** | Forbidden | - | -**404** | Not Found | - | -**422** | Unprocessable Entity | - | -**500** | Internal Server Error | - | - -[[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) - # **get_analysis_status** > BaseResponseStatus get_analysis_status(analysis_id) diff --git a/docs/CollectionListItemBody.md b/docs/CollectionListItemBody.md new file mode 100644 index 0000000..b761e3e --- /dev/null +++ b/docs/CollectionListItemBody.md @@ -0,0 +1,39 @@ +# CollectionListItemBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collection_id** | **int** | | +**collection_name** | **str** | | +**collection_owner** | **str** | | +**collection_scope** | **str** | | +**collection_size** | **int** | | +**collection_tags** | **List[str]** | | +**creation** | **datetime** | | +**description** | **str** | | +**model_name** | **str** | | +**official_collection** | **bool** | | +**team_id** | **int** | | + +## Example + +```python +from revengai.models.collection_list_item_body import CollectionListItemBody + +# TODO update the JSON string below +json = "{}" +# create an instance of CollectionListItemBody from a JSON string +collection_list_item_body_instance = CollectionListItemBody.from_json(json) +# print the JSON string representation of the object +print(CollectionListItemBody.to_json()) + +# convert the object into a dict +collection_list_item_body_dict = collection_list_item_body_instance.to_dict() +# create an instance of CollectionListItemBody from a dict +collection_list_item_body_from_dict = CollectionListItemBody.from_dict(collection_list_item_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/CollectionsApi.md b/docs/CollectionsApi.md index 614de10..a5a7fdc 100644 --- a/docs/CollectionsApi.md +++ b/docs/CollectionsApi.md @@ -5,13 +5,15 @@ All URIs are relative to *https://api.reveng.ai* Method | HTTP request | Description ------------- | ------------- | ------------- [**create_collection**](CollectionsApi.md#create_collection) | **POST** /v2/collections | Creates new collection information -[**create_collection_0**](CollectionsApi.md#create_collection_0) | **POST** /v3/collections | Create a collection. [**delete_collection**](CollectionsApi.md#delete_collection) | **DELETE** /v2/collections/{collection_id} | Deletes a collection [**get_collection**](CollectionsApi.md#get_collection) | **GET** /v2/collections/{collection_id} | Returns a collection [**list_collections**](CollectionsApi.md#list_collections) | **GET** /v2/collections | Gets basic collections information [**update_collection**](CollectionsApi.md#update_collection) | **PATCH** /v2/collections/{collection_id} | Updates a collection [**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_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. # **create_collection** @@ -95,93 +97,6 @@ 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) -# **create_collection_0** -> CreateCollectionOutputBody create_collection_0(create_collection_input_body) - -Create a collection. - -Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. - -**Error codes:** -- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found -- `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - -### Example - -* Api Key Authentication (APIKey): - -```python -import revengai -from revengai.models.create_collection_input_body import CreateCollectionInputBody -from revengai.models.create_collection_output_body import CreateCollectionOutputBody -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) - create_collection_input_body = revengai.CreateCollectionInputBody() # CreateCollectionInputBody | - - try: - # Create a collection. - api_response = api_instance.create_collection_0(create_collection_input_body) - print("The response of CollectionsApi->create_collection_0:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling CollectionsApi->create_collection_0: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **create_collection_input_body** | [**CreateCollectionInputBody**](CreateCollectionInputBody.md)| | - -### Return type - -[**CreateCollectionOutputBody**](CreateCollectionOutputBody.md) - -### Authorization - -[APIKey](../README.md#APIKey) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**201** | Created | - | -**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) - # **delete_collection** > BaseResponseBool delete_collection(collection_id) @@ -694,3 +609,279 @@ 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_create_collection** +> CreateCollectionOutputBody v3_create_collection(create_collection_input_body) + +Create a collection. + +Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found +- `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.create_collection_input_body import CreateCollectionInputBody +from revengai.models.create_collection_output_body import CreateCollectionOutputBody +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) + create_collection_input_body = revengai.CreateCollectionInputBody() # CreateCollectionInputBody | + + try: + # Create a collection. + api_response = api_instance.v3_create_collection(create_collection_input_body) + print("The response of CollectionsApi->v3_create_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionsApi->v3_create_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **create_collection_input_body** | [**CreateCollectionInputBody**](CreateCollectionInputBody.md)| | + +### Return type + +[**CreateCollectionOutputBody**](CreateCollectionOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | - | +**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_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) + +Get a collection. + +Gets a single collection by ID. Optionally include tags and paginated binaries. + +**Error codes:** +- `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.get_collection_output_body import GetCollectionOutputBody +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 | + include_tags = True # bool | (optional) + include_binaries = True # bool | (optional) + page_size = 10 # int | (optional) (default to 10) + page_number = 1 # int | (optional) (default to 1) + binary_search_str = 'binary_search_str_example' # str | (optional) + + try: + # Get a collection. + api_response = api_instance.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) + print("The response of CollectionsApi->v3_get_collection:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionsApi->v3_get_collection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **collection_id** | **int**| | + **include_tags** | **bool**| | [optional] + **include_binaries** | **bool**| | [optional] + **page_size** | **int**| | [optional] [default to 10] + **page_number** | **int**| | [optional] [default to 1] + **binary_search_str** | **str**| | [optional] + +### Return type + +[**GetCollectionOutputBody**](GetCollectionOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**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_list_collections** +> ListCollectionsOutputBody v3_list_collections(search_term=search_term, filters=filters, limit=limit, offset=offset, order_by=order_by, order=order) + +List collections. + +Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. + +**Error codes:** +- `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + +### Example + +* Api Key Authentication (APIKey): + +```python +import revengai +from revengai.models.list_collections_output_body import ListCollectionsOutputBody +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) + search_term = 'search_term_example' # str | (optional) + filters = ['filters_example'] # List[str] | (optional) + limit = 20 # int | (optional) (default to 20) + offset = 0 # int | (optional) (default to 0) + order_by = collection # str | (optional) (default to collection) + order = ASC # str | (optional) (default to ASC) + + try: + # List collections. + api_response = api_instance.v3_list_collections(search_term=search_term, filters=filters, limit=limit, offset=offset, order_by=order_by, order=order) + print("The response of CollectionsApi->v3_list_collections:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CollectionsApi->v3_list_collections: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **search_term** | **str**| | [optional] + **filters** | [**List[str]**](str.md)| | [optional] + **limit** | **int**| | [optional] [default to 20] + **offset** | **int**| | [optional] [default to 0] + **order_by** | **str**| | [optional] [default to collection] + **order** | **str**| | [optional] [default to ASC] + +### Return type + +[**ListCollectionsOutputBody**](ListCollectionsOutputBody.md) + +### Authorization + +[APIKey](../README.md#APIKey) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**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/GetCollectionOutputBody.md b/docs/GetCollectionOutputBody.md new file mode 100644 index 0000000..f41d7c3 --- /dev/null +++ b/docs/GetCollectionOutputBody.md @@ -0,0 +1,42 @@ +# GetCollectionOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**binaries** | [**List[Binary]**](Binary.md) | | [optional] +**collection_id** | **int** | | +**collection_name** | **str** | | +**collection_scope** | **str** | | +**created_at** | **datetime** | | +**description** | **str** | | +**has_next_page** | **bool** | | [optional] +**model_id** | **int** | | +**page_number** | **int** | | [optional] +**page_size** | **int** | | [optional] +**tags** | **List[str]** | | [optional] +**team_id** | **int** | | +**updated_at** | **datetime** | | +**user_id** | **int** | | + +## Example + +```python +from revengai.models.get_collection_output_body import GetCollectionOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of GetCollectionOutputBody from a JSON string +get_collection_output_body_instance = GetCollectionOutputBody.from_json(json) +# print the JSON string representation of the object +print(GetCollectionOutputBody.to_json()) + +# convert the object into a dict +get_collection_output_body_dict = get_collection_output_body_instance.to_dict() +# create an instance of GetCollectionOutputBody from a dict +get_collection_output_body_from_dict = GetCollectionOutputBody.from_dict(get_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/ListCollectionsOutputBody.md b/docs/ListCollectionsOutputBody.md new file mode 100644 index 0000000..a63e493 --- /dev/null +++ b/docs/ListCollectionsOutputBody.md @@ -0,0 +1,32 @@ +# ListCollectionsOutputBody + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**has_next_page** | **bool** | | +**page_number** | **int** | | +**page_size** | **int** | | +**results** | [**List[CollectionListItemBody]**](CollectionListItemBody.md) | | + +## Example + +```python +from revengai.models.list_collections_output_body import ListCollectionsOutputBody + +# TODO update the JSON string below +json = "{}" +# create an instance of ListCollectionsOutputBody from a JSON string +list_collections_output_body_instance = ListCollectionsOutputBody.from_json(json) +# print the JSON string representation of the object +print(ListCollectionsOutputBody.to_json()) + +# convert the object into a dict +list_collections_output_body_dict = list_collections_output_body_instance.to_dict() +# create an instance of ListCollectionsOutputBody from a dict +list_collections_output_body_from_dict = ListCollectionsOutputBody.from_dict(list_collections_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/QueuePositionResponse.md b/docs/QueuePositionResponse.md deleted file mode 100644 index 023d1c0..0000000 --- a/docs/QueuePositionResponse.md +++ /dev/null @@ -1,29 +0,0 @@ -# QueuePositionResponse - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**queue_position** | **int** | Number of Processing analyses ahead of this one in the queue. 0 if this analysis is not Processing or has no analyses ahead of it. | - -## Example - -```python -from revengai.models.queue_position_response import QueuePositionResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of QueuePositionResponse from a JSON string -queue_position_response_instance = QueuePositionResponse.from_json(json) -# print the JSON string representation of the object -print(QueuePositionResponse.to_json()) - -# convert the object into a dict -queue_position_response_dict = queue_position_response_instance.to_dict() -# create an instance of QueuePositionResponse from a dict -queue_position_response_from_dict = QueuePositionResponse.from_dict(queue_position_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/revengai/__init__.py b/revengai/__init__.py index 36f0cb8..5b8d9f1 100644 --- a/revengai/__init__.py +++ b/revengai/__init__.py @@ -13,7 +13,7 @@ """ # noqa: E501 -__version__ = "v3.91.0" +__version__ = "v3.91.1" # Define package exports __all__ = [ @@ -190,6 +190,7 @@ "CollectionBinaryResponse", "CollectionCreateRequest", "CollectionListItem", + "CollectionListItemBody", "CollectionResponse", "CollectionResponseBinariesInner", "CollectionScope", @@ -319,6 +320,7 @@ "GetAiDecompilationRatingResponse", "GetAiDecompilationTask", "GetAnalysisStringsStatusOutputBody", + "GetCollectionOutputBody", "GetProductsOutputBody", "GetPublicUserResponse", "GetSubscriptionOutputBody", @@ -336,6 +338,7 @@ "InverseValue", "ListAnalysisStringsOutputBody", "ListCollectionResults", + "ListCollectionsOutputBody", "ListFunctionStringsOutputBody", "Logs", "MITRETechnique", @@ -370,7 +373,6 @@ "ProgressMessage", "ProseEvent", "PutAnalysisStringsRequest", - "QueuePositionResponse", "QueuedWorkflowTaskResponse", "ReAnalysisForm", "Recent", @@ -644,6 +646,7 @@ from revengai.models.collection_binary_response import CollectionBinaryResponse as CollectionBinaryResponse from revengai.models.collection_create_request import CollectionCreateRequest as CollectionCreateRequest from revengai.models.collection_list_item import CollectionListItem as CollectionListItem +from revengai.models.collection_list_item_body import CollectionListItemBody as CollectionListItemBody from revengai.models.collection_response import CollectionResponse as CollectionResponse from revengai.models.collection_response_binaries_inner import CollectionResponseBinariesInner as CollectionResponseBinariesInner from revengai.models.collection_scope import CollectionScope as CollectionScope @@ -773,6 +776,7 @@ from revengai.models.get_ai_decompilation_rating_response import GetAiDecompilationRatingResponse as GetAiDecompilationRatingResponse from revengai.models.get_ai_decompilation_task import GetAiDecompilationTask as GetAiDecompilationTask from revengai.models.get_analysis_strings_status_output_body import GetAnalysisStringsStatusOutputBody as GetAnalysisStringsStatusOutputBody +from revengai.models.get_collection_output_body import GetCollectionOutputBody as GetCollectionOutputBody from revengai.models.get_products_output_body import GetProductsOutputBody as GetProductsOutputBody from revengai.models.get_public_user_response import GetPublicUserResponse as GetPublicUserResponse from revengai.models.get_subscription_output_body import GetSubscriptionOutputBody as GetSubscriptionOutputBody @@ -790,6 +794,7 @@ from revengai.models.inverse_value import InverseValue as InverseValue from revengai.models.list_analysis_strings_output_body import ListAnalysisStringsOutputBody as ListAnalysisStringsOutputBody from revengai.models.list_collection_results import ListCollectionResults as ListCollectionResults +from revengai.models.list_collections_output_body import ListCollectionsOutputBody as ListCollectionsOutputBody from revengai.models.list_function_strings_output_body import ListFunctionStringsOutputBody as ListFunctionStringsOutputBody from revengai.models.logs import Logs as Logs from revengai.models.mitre_technique import MITRETechnique as MITRETechnique @@ -824,7 +829,6 @@ from revengai.models.progress_message import ProgressMessage as ProgressMessage from revengai.models.prose_event import ProseEvent as ProseEvent from revengai.models.put_analysis_strings_request import PutAnalysisStringsRequest as PutAnalysisStringsRequest -from revengai.models.queue_position_response import QueuePositionResponse as QueuePositionResponse from revengai.models.queued_workflow_task_response import QueuedWorkflowTaskResponse as QueuedWorkflowTaskResponse from revengai.models.re_analysis_form import ReAnalysisForm as ReAnalysisForm from revengai.models.recent import Recent as Recent diff --git a/revengai/api/analyses_core_api.py b/revengai/api/analyses_core_api.py index 386c733..9c85962 100644 --- a/revengai/api/analyses_core_api.py +++ b/revengai/api/analyses_core_api.py @@ -44,7 +44,6 @@ from revengai.models.model_name import ModelName from revengai.models.order import Order from revengai.models.put_analysis_strings_request import PutAnalysisStringsRequest -from revengai.models.queue_position_response import QueuePositionResponse from revengai.models.re_analysis_form import ReAnalysisForm from revengai.models.status_input import StatusInput from revengai.models.upload_file_type import UploadFileType @@ -2562,279 +2561,6 @@ def _get_analysis_params_serialize( - @validate_call - def get_analysis_queue_position( - self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], - _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, - ) -> QueuePositionResponse: - """Get the queue position of an analysis - - Returns the number of Processing analyses with a lower analysis_id than the given one. Useful for showing the user where they sit in the processing queue while waiting for their analysis to start. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - - :param analysis_id: Analysis ID (required) - :type analysis_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._get_analysis_queue_position_serialize( - analysis_id=analysis_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "QueuePositionResponse", - '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 get_analysis_queue_position_with_http_info( - self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], - _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[QueuePositionResponse]: - """Get the queue position of an analysis - - Returns the number of Processing analyses with a lower analysis_id than the given one. Useful for showing the user where they sit in the processing queue while waiting for their analysis to start. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - - :param analysis_id: Analysis ID (required) - :type analysis_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._get_analysis_queue_position_serialize( - analysis_id=analysis_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "QueuePositionResponse", - '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 get_analysis_queue_position_without_preload_content( - self, - analysis_id: Annotated[int, Field(strict=True, ge=1, description="Analysis ID")], - _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: - """Get the queue position of an analysis - - Returns the number of Processing analyses with a lower analysis_id than the given one. Useful for showing the user where they sit in the processing queue while waiting for their analysis to start. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `403` [`ACCESS_DENIED`](/errors/ACCESS_DENIED) — Access Denied - - :param analysis_id: Analysis ID (required) - :type analysis_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._get_analysis_queue_position_serialize( - analysis_id=analysis_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "QueuePositionResponse", - '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 _get_analysis_queue_position_serialize( - self, - analysis_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 analysis_id is not None: - _path_params['analysis_id'] = analysis_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='GET', - resource_path='/v2/analyses/{analysis_id}/queue-position', - 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 get_analysis_status( self, diff --git a/revengai/api/collections_api.py b/revengai/api/collections_api.py index 155ca14..8ae458f 100644 --- a/revengai/api/collections_api.py +++ b/revengai/api/collections_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, StrictInt, StrictStr +from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator from typing import List, Optional from typing_extensions import Annotated from revengai.models.app_api_rest_v2_collections_enums_order_by import AppApiRestV2CollectionsEnumsOrderBy @@ -31,6 +31,8 @@ from revengai.models.create_collection_input_body import CreateCollectionInputBody from revengai.models.create_collection_output_body import CreateCollectionOutputBody from revengai.models.filters import Filters +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.api_client import ApiClient, RequestSerialized @@ -329,9 +331,9 @@ def _create_collection_serialize( @validate_call - def create_collection_0( + def delete_collection( self, - create_collection_input_body: CreateCollectionInputBody, + collection_id: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -344,13 +346,13 @@ def create_collection_0( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> CreateCollectionOutputBody: - """Create a collection. + ) -> BaseResponseBool: + """Deletes a collection - Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + Deletes a collection - :param create_collection_input_body: (required) - :type create_collection_input_body: CreateCollectionInputBody + :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 @@ -373,8 +375,8 @@ def create_collection_0( :return: Returns the result object. """ # noqa: E501 - _param = self._create_collection_0_serialize( - create_collection_input_body=create_collection_input_body, + _param = self._delete_collection_serialize( + collection_id=collection_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -382,10 +384,8 @@ def create_collection_0( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "CreateCollectionOutputBody", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '200': "BaseResponseBool", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -399,9 +399,9 @@ def create_collection_0( @validate_call - def create_collection_0_with_http_info( + def delete_collection_with_http_info( self, - create_collection_input_body: CreateCollectionInputBody, + collection_id: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -414,13 +414,13 @@ def create_collection_0_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[CreateCollectionOutputBody]: - """Create a collection. + ) -> ApiResponse[BaseResponseBool]: + """Deletes a collection - Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + Deletes a collection - :param create_collection_input_body: (required) - :type create_collection_input_body: CreateCollectionInputBody + :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 @@ -443,8 +443,8 @@ def create_collection_0_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._create_collection_0_serialize( - create_collection_input_body=create_collection_input_body, + _param = self._delete_collection_serialize( + collection_id=collection_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -452,10 +452,8 @@ def create_collection_0_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "CreateCollectionOutputBody", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '200': "BaseResponseBool", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -469,9 +467,9 @@ def create_collection_0_with_http_info( @validate_call - def create_collection_0_without_preload_content( + def delete_collection_without_preload_content( self, - create_collection_input_body: CreateCollectionInputBody, + collection_id: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -485,12 +483,12 @@ def create_collection_0_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Create a collection. + """Deletes a collection - Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed + Deletes a collection - :param create_collection_input_body: (required) - :type create_collection_input_body: CreateCollectionInputBody + :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 @@ -513,8 +511,8 @@ def create_collection_0_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._create_collection_0_serialize( - create_collection_input_body=create_collection_input_body, + _param = self._delete_collection_serialize( + collection_id=collection_id, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -522,10 +520,8 @@ def create_collection_0_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '201': "CreateCollectionOutputBody", - '404': "APIError", - '422': "APIError", - '500': "APIError", + '200': "BaseResponseBool", + '422': "BaseResponse", } response_data = self.api_client.call_api( *_param, @@ -534,9 +530,9 @@ def create_collection_0_without_preload_content( return response_data.response - def _create_collection_0_serialize( + def _delete_collection_serialize( self, - create_collection_input_body, + collection_id, _request_auth, _content_type, _headers, @@ -558,12 +554,12 @@ def _create_collection_0_serialize( _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 create_collection_input_body is not None: - _body_params = create_collection_input_body # set the HTTP header `Accept` @@ -574,19 +570,6 @@ def _create_collection_0_serialize( ] ) - # 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] = [ @@ -594,8 +577,8 @@ def _create_collection_0_serialize( ] return self.api_client.param_serialize( - method='POST', - resource_path='/v3/collections', + method='DELETE', + resource_path='/v2/collections/{collection_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -612,9 +595,14 @@ def _create_collection_0_serialize( @validate_call - def delete_collection( + def get_collection( self, collection_id: StrictInt, + include_tags: Optional[StrictBool] = None, + include_binaries: Optional[StrictBool] = None, + page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, + binary_search_str: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -627,13 +615,23 @@ def delete_collection( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseBool: - """Deletes a collection + ) -> BaseResponseCollectionResponse: + """Returns a collection - Deletes 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. :param collection_id: (required) :type collection_id: int + :param include_tags: + :type include_tags: bool + :param include_binaries: + :type include_binaries: bool + :param page_size: + :type page_size: int + :param page_number: + :type page_number: int + :param binary_search_str: + :type binary_search_str: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -656,8 +654,13 @@ def delete_collection( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_collection_serialize( + _param = self._get_collection_serialize( collection_id=collection_id, + include_tags=include_tags, + include_binaries=include_binaries, + page_size=page_size, + page_number=page_number, + binary_search_str=binary_search_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -665,7 +668,7 @@ def delete_collection( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseBool", + '200': "BaseResponseCollectionResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -680,9 +683,14 @@ def delete_collection( @validate_call - def delete_collection_with_http_info( + def get_collection_with_http_info( self, collection_id: StrictInt, + include_tags: Optional[StrictBool] = None, + include_binaries: Optional[StrictBool] = None, + page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, + binary_search_str: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -695,13 +703,23 @@ def delete_collection_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseBool]: - """Deletes a collection + ) -> ApiResponse[BaseResponseCollectionResponse]: + """Returns a collection - Deletes 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. :param collection_id: (required) :type collection_id: int + :param include_tags: + :type include_tags: bool + :param include_binaries: + :type include_binaries: bool + :param page_size: + :type page_size: int + :param page_number: + :type page_number: int + :param binary_search_str: + :type binary_search_str: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -724,8 +742,13 @@ def delete_collection_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_collection_serialize( + _param = self._get_collection_serialize( collection_id=collection_id, + include_tags=include_tags, + include_binaries=include_binaries, + page_size=page_size, + page_number=page_number, + binary_search_str=binary_search_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -733,7 +756,7 @@ def delete_collection_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseBool", + '200': "BaseResponseCollectionResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -748,9 +771,14 @@ def delete_collection_with_http_info( @validate_call - def delete_collection_without_preload_content( + def get_collection_without_preload_content( self, collection_id: StrictInt, + include_tags: Optional[StrictBool] = None, + include_binaries: Optional[StrictBool] = None, + page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, + binary_search_str: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -764,12 +792,22 @@ 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 + """Returns a collection - Deletes 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. :param collection_id: (required) :type collection_id: int + :param include_tags: + :type include_tags: bool + :param include_binaries: + :type include_binaries: bool + :param page_size: + :type page_size: int + :param page_number: + :type page_number: int + :param binary_search_str: + :type binary_search_str: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -792,8 +830,13 @@ def delete_collection_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_collection_serialize( + _param = self._get_collection_serialize( collection_id=collection_id, + include_tags=include_tags, + include_binaries=include_binaries, + page_size=page_size, + page_number=page_number, + binary_search_str=binary_search_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -801,7 +844,7 @@ def delete_collection_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseBool", + '200': "BaseResponseCollectionResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -811,9 +854,14 @@ def delete_collection_without_preload_content( return response_data.response - def _delete_collection_serialize( + def _get_collection_serialize( self, collection_id, + include_tags, + include_binaries, + page_size, + page_number, + binary_search_str, _request_auth, _content_type, _headers, @@ -838,6 +886,26 @@ def _delete_collection_serialize( if collection_id is not None: _path_params['collection_id'] = collection_id # process the query parameters + if include_tags is not None: + + _query_params.append(('include_tags', include_tags)) + + if include_binaries is not None: + + _query_params.append(('include_binaries', include_binaries)) + + if page_size is not None: + + _query_params.append(('page_size', page_size)) + + if page_number is not None: + + _query_params.append(('page_number', page_number)) + + if binary_search_str is not None: + + _query_params.append(('binary_search_str', binary_search_str)) + # process the header parameters # process the form parameters # process the body parameter @@ -858,7 +926,7 @@ def _delete_collection_serialize( ] return self.api_client.param_serialize( - method='DELETE', + method='GET', resource_path='/v2/collections/{collection_id}', path_params=_path_params, query_params=_query_params, @@ -876,14 +944,14 @@ def _delete_collection_serialize( @validate_call - def get_collection( + def list_collections( self, - collection_id: StrictInt, - include_tags: Optional[StrictBool] = None, - include_binaries: Optional[StrictBool] = None, - page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, - page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, - binary_search_str: Optional[StrictStr] = None, + search_term: Optional[StrictStr] = None, + filters: Optional[List[Filters]] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, + offset: Optional[StrictInt] = None, + order_by: Optional[AppApiRestV2CollectionsEnumsOrderBy] = None, + order: Optional[Order] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -896,23 +964,23 @@ def get_collection( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseCollectionResponse: - """Returns a collection + ) -> BaseResponseListCollectionResults: + """Gets basic collections information - 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. + Returns a list of collections - :param collection_id: (required) - :type collection_id: int - :param include_tags: - :type include_tags: bool - :param include_binaries: - :type include_binaries: bool - :param page_size: - :type page_size: int - :param page_number: - :type page_number: int - :param binary_search_str: - :type binary_search_str: str + :param search_term: + :type search_term: str + :param filters: + :type filters: List[Filters] + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: AppApiRestV2CollectionsEnumsOrderBy + :param order: + :type order: Order :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 @@ -935,13 +1003,13 @@ def get_collection( :return: Returns the result object. """ # noqa: E501 - _param = self._get_collection_serialize( - collection_id=collection_id, - include_tags=include_tags, - include_binaries=include_binaries, - page_size=page_size, - page_number=page_number, - binary_search_str=binary_search_str, + _param = self._list_collections_serialize( + search_term=search_term, + filters=filters, + limit=limit, + offset=offset, + order_by=order_by, + order=order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -949,7 +1017,7 @@ def get_collection( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionResponse", + '200': "BaseResponseListCollectionResults", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -964,14 +1032,14 @@ def get_collection( @validate_call - def get_collection_with_http_info( + def list_collections_with_http_info( self, - collection_id: StrictInt, - include_tags: Optional[StrictBool] = None, - include_binaries: Optional[StrictBool] = None, - page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, - page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, - binary_search_str: Optional[StrictStr] = None, + search_term: Optional[StrictStr] = None, + filters: Optional[List[Filters]] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, + offset: Optional[StrictInt] = None, + order_by: Optional[AppApiRestV2CollectionsEnumsOrderBy] = None, + order: Optional[Order] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -984,23 +1052,23 @@ def get_collection_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseCollectionResponse]: - """Returns a collection + ) -> ApiResponse[BaseResponseListCollectionResults]: + """Gets basic collections information - 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. + Returns a list of collections - :param collection_id: (required) - :type collection_id: int - :param include_tags: - :type include_tags: bool - :param include_binaries: - :type include_binaries: bool - :param page_size: - :type page_size: int - :param page_number: - :type page_number: int - :param binary_search_str: - :type binary_search_str: str + :param search_term: + :type search_term: str + :param filters: + :type filters: List[Filters] + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: AppApiRestV2CollectionsEnumsOrderBy + :param order: + :type order: Order :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 @@ -1023,13 +1091,13 @@ def get_collection_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_collection_serialize( - collection_id=collection_id, - include_tags=include_tags, - include_binaries=include_binaries, - page_size=page_size, - page_number=page_number, - binary_search_str=binary_search_str, + _param = self._list_collections_serialize( + search_term=search_term, + filters=filters, + limit=limit, + offset=offset, + order_by=order_by, + order=order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1037,7 +1105,7 @@ def get_collection_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionResponse", + '200': "BaseResponseListCollectionResults", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -1052,14 +1120,14 @@ def get_collection_with_http_info( @validate_call - def get_collection_without_preload_content( + def list_collections_without_preload_content( self, - collection_id: StrictInt, - include_tags: Optional[StrictBool] = None, - include_binaries: Optional[StrictBool] = None, - page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, - page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, - binary_search_str: Optional[StrictStr] = None, + search_term: Optional[StrictStr] = None, + filters: Optional[List[Filters]] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, + offset: Optional[StrictInt] = None, + order_by: Optional[AppApiRestV2CollectionsEnumsOrderBy] = None, + order: Optional[Order] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1073,22 +1141,22 @@ 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 + """Gets basic collections information - 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. + Returns a list of collections - :param collection_id: (required) - :type collection_id: int - :param include_tags: - :type include_tags: bool - :param include_binaries: - :type include_binaries: bool - :param page_size: - :type page_size: int - :param page_number: - :type page_number: int - :param binary_search_str: - :type binary_search_str: str + :param search_term: + :type search_term: str + :param filters: + :type filters: List[Filters] + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: AppApiRestV2CollectionsEnumsOrderBy + :param order: + :type order: Order :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 @@ -1111,13 +1179,13 @@ def get_collection_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_collection_serialize( - collection_id=collection_id, - include_tags=include_tags, - include_binaries=include_binaries, - page_size=page_size, - page_number=page_number, - binary_search_str=binary_search_str, + _param = self._list_collections_serialize( + search_term=search_term, + filters=filters, + limit=limit, + offset=offset, + order_by=order_by, + order=order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1125,7 +1193,7 @@ def get_collection_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionResponse", + '200': "BaseResponseListCollectionResults", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -1135,14 +1203,14 @@ def get_collection_without_preload_content( return response_data.response - def _get_collection_serialize( + def _list_collections_serialize( self, - collection_id, - include_tags, - include_binaries, - page_size, - page_number, - binary_search_str, + search_term, + filters, + limit, + offset, + order_by, + order, _request_auth, _content_type, _headers, @@ -1152,6 +1220,7 @@ def _get_collection_serialize( _host = None _collection_formats: Dict[str, str] = { + 'filters': 'multi', } _path_params: Dict[str, str] = {} @@ -1164,28 +1233,30 @@ def _get_collection_serialize( _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 - if include_tags is not None: + if search_term is not None: - _query_params.append(('include_tags', include_tags)) + _query_params.append(('search_term', search_term)) - if include_binaries is not None: + if filters is not None: - _query_params.append(('include_binaries', include_binaries)) + _query_params.append(('filters', filters)) - if page_size is not None: + if limit is not None: - _query_params.append(('page_size', page_size)) + _query_params.append(('limit', limit)) - if page_number is not None: + if offset is not None: - _query_params.append(('page_number', page_number)) + _query_params.append(('offset', offset)) - if binary_search_str is not None: + if order_by is not None: - _query_params.append(('binary_search_str', binary_search_str)) + _query_params.append(('order_by', order_by.value)) + + if order is not None: + + _query_params.append(('order', order.value)) # process the header parameters # process the form parameters @@ -1208,7 +1279,7 @@ def _get_collection_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v2/collections/{collection_id}', + resource_path='/v2/collections', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1225,14 +1296,10 @@ def _get_collection_serialize( @validate_call - def list_collections( + def update_collection( self, - search_term: Optional[StrictStr] = None, - filters: Optional[List[Filters]] = None, - limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, - offset: Optional[StrictInt] = None, - order_by: Optional[AppApiRestV2CollectionsEnumsOrderBy] = None, - order: Optional[Order] = None, + collection_id: StrictInt, + collection_update_request: CollectionUpdateRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1245,23 +1312,15 @@ def list_collections( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseListCollectionResults: - """Gets basic collections information + ) -> BaseResponseCollectionResponse: + """Updates a collection - Returns a list of collections + Updates a collection, you can update the collection name, description, and scope - :param search_term: - :type search_term: str - :param filters: - :type filters: List[Filters] - :param limit: - :type limit: int - :param offset: - :type offset: int - :param order_by: - :type order_by: AppApiRestV2CollectionsEnumsOrderBy - :param order: - :type order: Order + :param collection_id: (required) + :type collection_id: int + :param collection_update_request: (required) + :type collection_update_request: CollectionUpdateRequest :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 @@ -1284,13 +1343,9 @@ def list_collections( :return: Returns the result object. """ # noqa: E501 - _param = self._list_collections_serialize( - search_term=search_term, - filters=filters, - limit=limit, - offset=offset, - order_by=order_by, - order=order, + _param = self._update_collection_serialize( + collection_id=collection_id, + collection_update_request=collection_update_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1298,7 +1353,7 @@ def list_collections( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseListCollectionResults", + '200': "BaseResponseCollectionResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -1313,14 +1368,10 @@ def list_collections( @validate_call - def list_collections_with_http_info( + def update_collection_with_http_info( self, - search_term: Optional[StrictStr] = None, - filters: Optional[List[Filters]] = None, - limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, - offset: Optional[StrictInt] = None, - order_by: Optional[AppApiRestV2CollectionsEnumsOrderBy] = None, - order: Optional[Order] = None, + collection_id: StrictInt, + collection_update_request: CollectionUpdateRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1333,23 +1384,599 @@ def list_collections_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseListCollectionResults]: - """Gets basic collections information + ) -> ApiResponse[BaseResponseCollectionResponse]: + """Updates a collection - Returns a list of collections + Updates a collection, you can update the collection name, description, and scope - :param search_term: - :type search_term: str - :param filters: - :type filters: List[Filters] - :param limit: - :type limit: int - :param offset: - :type offset: int - :param order_by: - :type order_by: AppApiRestV2CollectionsEnumsOrderBy - :param order: - :type order: Order + :param collection_id: (required) + :type collection_id: int + :param collection_update_request: (required) + :type collection_update_request: CollectionUpdateRequest + :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._update_collection_serialize( + collection_id=collection_id, + collection_update_request=collection_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseCollectionResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_collection_without_preload_content( + self, + collection_id: StrictInt, + collection_update_request: CollectionUpdateRequest, + _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: + """Updates a collection + + Updates a collection, you can update the collection name, description, and scope + + :param collection_id: (required) + :type collection_id: int + :param collection_update_request: (required) + :type collection_update_request: CollectionUpdateRequest + :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._update_collection_serialize( + collection_id=collection_id, + collection_update_request=collection_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseCollectionResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_collection_serialize( + self, + collection_id, + collection_update_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + 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 collection_update_request is not None: + _body_params = collection_update_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/v2/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 update_collection_binaries( + self, + collection_id: StrictInt, + collection_binaries_update_request: CollectionBinariesUpdateRequest, + _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, + ) -> BaseResponseCollectionBinariesUpdateResponse: + """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. + + :param collection_id: (required) + :type collection_id: int + :param collection_binaries_update_request: (required) + :type collection_binaries_update_request: CollectionBinariesUpdateRequest + :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._update_collection_binaries_serialize( + collection_id=collection_id, + collection_binaries_update_request=collection_binaries_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseCollectionBinariesUpdateResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_collection_binaries_with_http_info( + self, + collection_id: StrictInt, + collection_binaries_update_request: CollectionBinariesUpdateRequest, + _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[BaseResponseCollectionBinariesUpdateResponse]: + """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. + + :param collection_id: (required) + :type collection_id: int + :param collection_binaries_update_request: (required) + :type collection_binaries_update_request: CollectionBinariesUpdateRequest + :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._update_collection_binaries_serialize( + collection_id=collection_id, + collection_binaries_update_request=collection_binaries_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseCollectionBinariesUpdateResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def update_collection_binaries_without_preload_content( + self, + collection_id: StrictInt, + collection_binaries_update_request: CollectionBinariesUpdateRequest, + _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: + """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. + + :param collection_id: (required) + :type collection_id: int + :param collection_binaries_update_request: (required) + :type collection_binaries_update_request: CollectionBinariesUpdateRequest + :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._update_collection_binaries_serialize( + collection_id=collection_id, + collection_binaries_update_request=collection_binaries_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseCollectionBinariesUpdateResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_collection_binaries_serialize( + self, + collection_id, + collection_binaries_update_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + 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 collection_binaries_update_request is not None: + _body_params = collection_binaries_update_request + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'APIKey' + ] + + return self.api_client.param_serialize( + method='PATCH', + resource_path='/v2/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 update_collection_tags( + self, + collection_id: StrictInt, + collection_tags_update_request: CollectionTagsUpdateRequest, + _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, + ) -> BaseResponseCollectionTagsUpdateResponse: + """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. + + :param collection_id: (required) + :type collection_id: int + :param collection_tags_update_request: (required) + :type collection_tags_update_request: CollectionTagsUpdateRequest + :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._update_collection_tags_serialize( + collection_id=collection_id, + collection_tags_update_request=collection_tags_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "BaseResponseCollectionTagsUpdateResponse", + '422': "BaseResponse", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def update_collection_tags_with_http_info( + self, + collection_id: StrictInt, + collection_tags_update_request: CollectionTagsUpdateRequest, + _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[BaseResponseCollectionTagsUpdateResponse]: + """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. + + :param collection_id: (required) + :type collection_id: int + :param collection_tags_update_request: (required) + :type collection_tags_update_request: CollectionTagsUpdateRequest :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 @@ -1372,13 +1999,9 @@ def list_collections_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_collections_serialize( - search_term=search_term, - filters=filters, - limit=limit, - offset=offset, - order_by=order_by, - order=order, + _param = self._update_collection_tags_serialize( + collection_id=collection_id, + collection_tags_update_request=collection_tags_update_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1386,7 +2009,7 @@ def list_collections_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseListCollectionResults", + '200': "BaseResponseCollectionTagsUpdateResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -1401,14 +2024,10 @@ def list_collections_with_http_info( @validate_call - def list_collections_without_preload_content( + def update_collection_tags_without_preload_content( self, - search_term: Optional[StrictStr] = None, - filters: Optional[List[Filters]] = None, - limit: Optional[Annotated[int, Field(le=50, strict=True, ge=5)]] = None, - offset: Optional[StrictInt] = None, - order_by: Optional[AppApiRestV2CollectionsEnumsOrderBy] = None, - order: Optional[Order] = None, + collection_id: StrictInt, + collection_tags_update_request: CollectionTagsUpdateRequest, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1422,22 +2041,14 @@ 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 + """Updates a collection tags - Returns a list of collections + 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. - :param search_term: - :type search_term: str - :param filters: - :type filters: List[Filters] - :param limit: - :type limit: int - :param offset: - :type offset: int - :param order_by: - :type order_by: AppApiRestV2CollectionsEnumsOrderBy - :param order: - :type order: Order + :param collection_id: (required) + :type collection_id: int + :param collection_tags_update_request: (required) + :type collection_tags_update_request: CollectionTagsUpdateRequest :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 @@ -1460,13 +2071,9 @@ def list_collections_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_collections_serialize( - search_term=search_term, - filters=filters, - limit=limit, - offset=offset, - order_by=order_by, - order=order, + _param = self._update_collection_tags_serialize( + collection_id=collection_id, + collection_tags_update_request=collection_tags_update_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1474,7 +2081,7 @@ def list_collections_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseListCollectionResults", + '200': "BaseResponseCollectionTagsUpdateResponse", '422': "BaseResponse", } response_data = self.api_client.call_api( @@ -1484,14 +2091,10 @@ def list_collections_without_preload_content( return response_data.response - def _list_collections_serialize( + def _update_collection_tags_serialize( self, - search_term, - filters, - limit, - offset, - order_by, - order, + collection_id, + collection_tags_update_request, _request_auth, _content_type, _headers, @@ -1501,7 +2104,6 @@ def _list_collections_serialize( _host = None _collection_formats: Dict[str, str] = { - 'filters': 'multi', } _path_params: Dict[str, str] = {} @@ -1514,34 +2116,14 @@ def _list_collections_serialize( _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 - if search_term is not None: - - _query_params.append(('search_term', search_term)) - - if filters is not None: - - _query_params.append(('filters', filters)) - - if limit is not None: - - _query_params.append(('limit', limit)) - - if offset is not None: - - _query_params.append(('offset', offset)) - - if order_by is not None: - - _query_params.append(('order_by', order_by.value)) - - if order is not None: - - _query_params.append(('order', order.value)) - # process the header parameters # process the form parameters # process the body parameter + if collection_tags_update_request is not None: + _body_params = collection_tags_update_request # set the HTTP header `Accept` @@ -1552,6 +2134,19 @@ def _list_collections_serialize( ] ) + # 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] = [ @@ -1559,8 +2154,8 @@ def _list_collections_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/v2/collections', + method='PATCH', + resource_path='/v2/collections/{collection_id}/tags', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1577,10 +2172,9 @@ def _list_collections_serialize( @validate_call - def update_collection( + def v3_create_collection( self, - collection_id: StrictInt, - collection_update_request: CollectionUpdateRequest, + create_collection_input_body: CreateCollectionInputBody, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1593,15 +2187,13 @@ def update_collection( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseCollectionResponse: - """Updates a collection + ) -> CreateCollectionOutputBody: + """Create a collection. - Updates a collection, you can update the collection name, description, and scope + Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - :param collection_id: (required) - :type collection_id: int - :param collection_update_request: (required) - :type collection_update_request: CollectionUpdateRequest + :param create_collection_input_body: (required) + :type create_collection_input_body: CreateCollectionInputBody :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 @@ -1624,9 +2216,8 @@ def update_collection( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_serialize( - collection_id=collection_id, - collection_update_request=collection_update_request, + _param = self._v3_create_collection_serialize( + create_collection_input_body=create_collection_input_body, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1634,8 +2225,10 @@ def update_collection( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionResponse", - '422': "BaseResponse", + '201': "CreateCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -1649,10 +2242,9 @@ def update_collection( @validate_call - def update_collection_with_http_info( + def v3_create_collection_with_http_info( self, - collection_id: StrictInt, - collection_update_request: CollectionUpdateRequest, + create_collection_input_body: CreateCollectionInputBody, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1665,15 +2257,13 @@ def update_collection_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseCollectionResponse]: - """Updates a collection + ) -> ApiResponse[CreateCollectionOutputBody]: + """Create a collection. - Updates a collection, you can update the collection name, description, and scope + Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - :param collection_id: (required) - :type collection_id: int - :param collection_update_request: (required) - :type collection_update_request: CollectionUpdateRequest + :param create_collection_input_body: (required) + :type create_collection_input_body: CreateCollectionInputBody :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 @@ -1696,9 +2286,8 @@ def update_collection_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_serialize( - collection_id=collection_id, - collection_update_request=collection_update_request, + _param = self._v3_create_collection_serialize( + create_collection_input_body=create_collection_input_body, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1706,8 +2295,10 @@ def update_collection_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionResponse", - '422': "BaseResponse", + '201': "CreateCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -1721,10 +2312,9 @@ def update_collection_with_http_info( @validate_call - def update_collection_without_preload_content( + def v3_create_collection_without_preload_content( self, - collection_id: StrictInt, - collection_update_request: CollectionUpdateRequest, + create_collection_input_body: CreateCollectionInputBody, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1738,14 +2328,12 @@ 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 + """Create a collection. - Updates a collection, you can update the collection name, description, and scope + Creates a new collection, optionally tagging it and linking binary IDs to it. Tags and binaries are returned in the response only when they were supplied in the request. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - :param collection_id: (required) - :type collection_id: int - :param collection_update_request: (required) - :type collection_update_request: CollectionUpdateRequest + :param create_collection_input_body: (required) + :type create_collection_input_body: CreateCollectionInputBody :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 @@ -1768,9 +2356,8 @@ def update_collection_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_serialize( - collection_id=collection_id, - collection_update_request=collection_update_request, + _param = self._v3_create_collection_serialize( + create_collection_input_body=create_collection_input_body, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1778,8 +2365,10 @@ def update_collection_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionResponse", - '422': "BaseResponse", + '201': "CreateCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -1788,10 +2377,9 @@ def update_collection_without_preload_content( return response_data.response - def _update_collection_serialize( + def _v3_create_collection_serialize( self, - collection_id, - collection_update_request, + create_collection_input_body, _request_auth, _content_type, _headers, @@ -1813,14 +2401,12 @@ def _update_collection_serialize( _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 collection_update_request is not None: - _body_params = collection_update_request + if create_collection_input_body is not None: + _body_params = create_collection_input_body # set the HTTP header `Accept` @@ -1851,8 +2437,8 @@ def _update_collection_serialize( ] return self.api_client.param_serialize( - method='PATCH', - resource_path='/v2/collections/{collection_id}', + method='POST', + resource_path='/v3/collections', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1869,10 +2455,14 @@ def _update_collection_serialize( @validate_call - def update_collection_binaries( + def v3_get_collection( self, - collection_id: StrictInt, - collection_binaries_update_request: CollectionBinariesUpdateRequest, + collection_id: Annotated[int, Field(strict=True, ge=1)], + include_tags: Optional[StrictBool] = None, + include_binaries: Optional[StrictBool] = None, + page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, + binary_search_str: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1885,15 +2475,23 @@ def update_collection_binaries( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseCollectionBinariesUpdateResponse: - """Updates a collection binaries + ) -> GetCollectionOutputBody: + """Get a collection. - 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. + Gets a single collection by ID. Optionally include tags and paginated binaries. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found :param collection_id: (required) :type collection_id: int - :param collection_binaries_update_request: (required) - :type collection_binaries_update_request: CollectionBinariesUpdateRequest + :param include_tags: + :type include_tags: bool + :param include_binaries: + :type include_binaries: bool + :param page_size: + :type page_size: int + :param page_number: + :type page_number: int + :param binary_search_str: + :type binary_search_str: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1916,9 +2514,13 @@ def update_collection_binaries( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_binaries_serialize( + _param = self._v3_get_collection_serialize( collection_id=collection_id, - collection_binaries_update_request=collection_binaries_update_request, + include_tags=include_tags, + include_binaries=include_binaries, + page_size=page_size, + page_number=page_number, + binary_search_str=binary_search_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1926,8 +2528,10 @@ def update_collection_binaries( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionBinariesUpdateResponse", - '422': "BaseResponse", + '200': "GetCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -1941,10 +2545,14 @@ def update_collection_binaries( @validate_call - def update_collection_binaries_with_http_info( + def v3_get_collection_with_http_info( self, - collection_id: StrictInt, - collection_binaries_update_request: CollectionBinariesUpdateRequest, + collection_id: Annotated[int, Field(strict=True, ge=1)], + include_tags: Optional[StrictBool] = None, + include_binaries: Optional[StrictBool] = None, + page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, + binary_search_str: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1957,15 +2565,23 @@ def update_collection_binaries_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseCollectionBinariesUpdateResponse]: - """Updates a collection binaries + ) -> ApiResponse[GetCollectionOutputBody]: + """Get a collection. - 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. + Gets a single collection by ID. Optionally include tags and paginated binaries. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found :param collection_id: (required) :type collection_id: int - :param collection_binaries_update_request: (required) - :type collection_binaries_update_request: CollectionBinariesUpdateRequest + :param include_tags: + :type include_tags: bool + :param include_binaries: + :type include_binaries: bool + :param page_size: + :type page_size: int + :param page_number: + :type page_number: int + :param binary_search_str: + :type binary_search_str: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1988,9 +2604,13 @@ def update_collection_binaries_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_binaries_serialize( + _param = self._v3_get_collection_serialize( collection_id=collection_id, - collection_binaries_update_request=collection_binaries_update_request, + include_tags=include_tags, + include_binaries=include_binaries, + page_size=page_size, + page_number=page_number, + binary_search_str=binary_search_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1998,8 +2618,10 @@ def update_collection_binaries_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionBinariesUpdateResponse", - '422': "BaseResponse", + '200': "GetCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -2013,10 +2635,14 @@ def update_collection_binaries_with_http_info( @validate_call - def update_collection_binaries_without_preload_content( + def v3_get_collection_without_preload_content( self, - collection_id: StrictInt, - collection_binaries_update_request: CollectionBinariesUpdateRequest, + collection_id: Annotated[int, Field(strict=True, ge=1)], + include_tags: Optional[StrictBool] = None, + include_binaries: Optional[StrictBool] = None, + page_size: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + page_number: Optional[Annotated[int, Field(strict=True, ge=1)]] = None, + binary_search_str: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2030,14 +2656,22 @@ 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 + """Get a collection. - 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. + Gets a single collection by ID. Optionally include tags and paginated binaries. **Error codes:** - `404` [`NOT_FOUND`](/errors/NOT_FOUND) — Not Found :param collection_id: (required) :type collection_id: int - :param collection_binaries_update_request: (required) - :type collection_binaries_update_request: CollectionBinariesUpdateRequest + :param include_tags: + :type include_tags: bool + :param include_binaries: + :type include_binaries: bool + :param page_size: + :type page_size: int + :param page_number: + :type page_number: int + :param binary_search_str: + :type binary_search_str: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2060,9 +2694,13 @@ def update_collection_binaries_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_binaries_serialize( + _param = self._v3_get_collection_serialize( collection_id=collection_id, - collection_binaries_update_request=collection_binaries_update_request, + include_tags=include_tags, + include_binaries=include_binaries, + page_size=page_size, + page_number=page_number, + binary_search_str=binary_search_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2070,8 +2708,10 @@ def update_collection_binaries_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionBinariesUpdateResponse", - '422': "BaseResponse", + '200': "GetCollectionOutputBody", + '404': "APIError", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -2080,10 +2720,14 @@ def update_collection_binaries_without_preload_content( return response_data.response - def _update_collection_binaries_serialize( + def _v3_get_collection_serialize( self, collection_id, - collection_binaries_update_request, + include_tags, + include_binaries, + page_size, + page_number, + binary_search_str, _request_auth, _content_type, _headers, @@ -2108,11 +2752,29 @@ def _update_collection_binaries_serialize( if collection_id is not None: _path_params['collection_id'] = collection_id # process the query parameters + if include_tags is not None: + + _query_params.append(('include_tags', include_tags)) + + if include_binaries is not None: + + _query_params.append(('include_binaries', include_binaries)) + + if page_size is not None: + + _query_params.append(('page_size', page_size)) + + if page_number is not None: + + _query_params.append(('page_number', page_number)) + + if binary_search_str is not None: + + _query_params.append(('binary_search_str', binary_search_str)) + # process the header parameters # process the form parameters # process the body parameter - if collection_binaries_update_request is not None: - _body_params = collection_binaries_update_request # set the HTTP header `Accept` @@ -2123,19 +2785,6 @@ def _update_collection_binaries_serialize( ] ) - # 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] = [ @@ -2143,8 +2792,8 @@ def _update_collection_binaries_serialize( ] return self.api_client.param_serialize( - method='PATCH', - resource_path='/v2/collections/{collection_id}/binaries', + method='GET', + resource_path='/v3/collections/{collection_id}', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2161,10 +2810,14 @@ def _update_collection_binaries_serialize( @validate_call - def update_collection_tags( + def v3_list_collections( self, - collection_id: StrictInt, - collection_tags_update_request: CollectionTagsUpdateRequest, + search_term: Optional[StrictStr] = None, + filters: Optional[List[StrictStr]] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None, + offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None, + order_by: Optional[StrictStr] = None, + order: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2177,15 +2830,23 @@ def update_collection_tags( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> BaseResponseCollectionTagsUpdateResponse: - """Updates a collection tags + ) -> ListCollectionsOutputBody: + """List collections. - 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. + Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - :param collection_id: (required) - :type collection_id: int - :param collection_tags_update_request: (required) - :type collection_tags_update_request: CollectionTagsUpdateRequest + :param search_term: + :type search_term: str + :param filters: + :type filters: List[str] + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: str + :param order: + :type order: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2208,9 +2869,13 @@ def update_collection_tags( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_tags_serialize( - collection_id=collection_id, - collection_tags_update_request=collection_tags_update_request, + _param = self._v3_list_collections_serialize( + search_term=search_term, + filters=filters, + limit=limit, + offset=offset, + order_by=order_by, + order=order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2218,8 +2883,9 @@ def update_collection_tags( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionTagsUpdateResponse", - '422': "BaseResponse", + '200': "ListCollectionsOutputBody", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -2233,10 +2899,14 @@ def update_collection_tags( @validate_call - def update_collection_tags_with_http_info( + def v3_list_collections_with_http_info( self, - collection_id: StrictInt, - collection_tags_update_request: CollectionTagsUpdateRequest, + search_term: Optional[StrictStr] = None, + filters: Optional[List[StrictStr]] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None, + offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None, + order_by: Optional[StrictStr] = None, + order: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2249,15 +2919,23 @@ def update_collection_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[BaseResponseCollectionTagsUpdateResponse]: - """Updates a collection tags + ) -> ApiResponse[ListCollectionsOutputBody]: + """List collections. - 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. + Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - :param collection_id: (required) - :type collection_id: int - :param collection_tags_update_request: (required) - :type collection_tags_update_request: CollectionTagsUpdateRequest + :param search_term: + :type search_term: str + :param filters: + :type filters: List[str] + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: str + :param order: + :type order: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2280,9 +2958,13 @@ def update_collection_tags_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_tags_serialize( - collection_id=collection_id, - collection_tags_update_request=collection_tags_update_request, + _param = self._v3_list_collections_serialize( + search_term=search_term, + filters=filters, + limit=limit, + offset=offset, + order_by=order_by, + order=order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2290,8 +2972,9 @@ def update_collection_tags_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionTagsUpdateResponse", - '422': "BaseResponse", + '200': "ListCollectionsOutputBody", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -2305,10 +2988,14 @@ def update_collection_tags_with_http_info( @validate_call - def update_collection_tags_without_preload_content( + def v3_list_collections_without_preload_content( self, - collection_id: StrictInt, - collection_tags_update_request: CollectionTagsUpdateRequest, + search_term: Optional[StrictStr] = None, + filters: Optional[List[StrictStr]] = None, + limit: Optional[Annotated[int, Field(le=50, strict=True, ge=1)]] = None, + offset: Optional[Annotated[int, Field(strict=True, ge=0)]] = None, + order_by: Optional[StrictStr] = None, + order: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2322,14 +3009,22 @@ 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 + """List collections. - 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. + Lists collections accessible to the authenticated user. Supports search, filtering, ordering, and pagination. **Error codes:** - `422` [`VALIDATION_FAILED`](/errors/VALIDATION_FAILED) — Validation Failed - :param collection_id: (required) - :type collection_id: int - :param collection_tags_update_request: (required) - :type collection_tags_update_request: CollectionTagsUpdateRequest + :param search_term: + :type search_term: str + :param filters: + :type filters: List[str] + :param limit: + :type limit: int + :param offset: + :type offset: int + :param order_by: + :type order_by: str + :param order: + :type order: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -2352,9 +3047,13 @@ def update_collection_tags_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._update_collection_tags_serialize( - collection_id=collection_id, - collection_tags_update_request=collection_tags_update_request, + _param = self._v3_list_collections_serialize( + search_term=search_term, + filters=filters, + limit=limit, + offset=offset, + order_by=order_by, + order=order, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2362,8 +3061,9 @@ def update_collection_tags_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "BaseResponseCollectionTagsUpdateResponse", - '422': "BaseResponse", + '200': "ListCollectionsOutputBody", + '422': "APIError", + '500': "APIError", } response_data = self.api_client.call_api( *_param, @@ -2372,10 +3072,14 @@ def update_collection_tags_without_preload_content( return response_data.response - def _update_collection_tags_serialize( + def _v3_list_collections_serialize( self, - collection_id, - collection_tags_update_request, + search_term, + filters, + limit, + offset, + order_by, + order, _request_auth, _content_type, _headers, @@ -2385,6 +3089,7 @@ def _update_collection_tags_serialize( _host = None _collection_formats: Dict[str, str] = { + 'filters': 'csv', } _path_params: Dict[str, str] = {} @@ -2397,14 +3102,34 @@ def _update_collection_tags_serialize( _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 + if search_term is not None: + + _query_params.append(('search_term', search_term)) + + if filters is not None: + + _query_params.append(('filters', filters)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if offset is not None: + + _query_params.append(('offset', offset)) + + if order_by is not None: + + _query_params.append(('order_by', order_by)) + + if order is not None: + + _query_params.append(('order', order)) + # process the header parameters # process the form parameters # process the body parameter - if collection_tags_update_request is not None: - _body_params = collection_tags_update_request # set the HTTP header `Accept` @@ -2415,19 +3140,6 @@ def _update_collection_tags_serialize( ] ) - # 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] = [ @@ -2435,8 +3147,8 @@ def _update_collection_tags_serialize( ] return self.api_client.param_serialize( - method='PATCH', - resource_path='/v2/collections/{collection_id}/tags', + method='GET', + resource_path='/v3/collections', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/revengai/api_client.py b/revengai/api_client.py index ad2d8ce..d7e4035 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.0/python' + self.user_agent = 'OpenAPI-Generator/v3.91.1/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/revengai/configuration.py b/revengai/configuration.py index b7b2ce3..0f9c7c0 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.0\n"\ - "SDK Package Version: v3.91.0".\ + "Version of the API: v3.91.1\n"\ + "SDK Package Version: v3.91.1".\ 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 c4e53b2..e2117dc 100644 --- a/revengai/models/__init__.py +++ b/revengai/models/__init__.py @@ -156,6 +156,7 @@ from revengai.models.collection_binary_response import CollectionBinaryResponse from revengai.models.collection_create_request import CollectionCreateRequest from revengai.models.collection_list_item import CollectionListItem +from revengai.models.collection_list_item_body import CollectionListItemBody from revengai.models.collection_response import CollectionResponse from revengai.models.collection_response_binaries_inner import CollectionResponseBinariesInner from revengai.models.collection_scope import CollectionScope @@ -285,6 +286,7 @@ from revengai.models.get_ai_decompilation_rating_response import GetAiDecompilationRatingResponse from revengai.models.get_ai_decompilation_task import GetAiDecompilationTask from revengai.models.get_analysis_strings_status_output_body import GetAnalysisStringsStatusOutputBody +from revengai.models.get_collection_output_body import GetCollectionOutputBody from revengai.models.get_products_output_body import GetProductsOutputBody from revengai.models.get_public_user_response import GetPublicUserResponse from revengai.models.get_subscription_output_body import GetSubscriptionOutputBody @@ -302,6 +304,7 @@ from revengai.models.inverse_value import InverseValue from revengai.models.list_analysis_strings_output_body import ListAnalysisStringsOutputBody from revengai.models.list_collection_results import ListCollectionResults +from revengai.models.list_collections_output_body import ListCollectionsOutputBody from revengai.models.list_function_strings_output_body import ListFunctionStringsOutputBody from revengai.models.logs import Logs from revengai.models.mitre_technique import MITRETechnique @@ -336,7 +339,6 @@ from revengai.models.progress_message import ProgressMessage from revengai.models.prose_event import ProseEvent from revengai.models.put_analysis_strings_request import PutAnalysisStringsRequest -from revengai.models.queue_position_response import QueuePositionResponse from revengai.models.queued_workflow_task_response import QueuedWorkflowTaskResponse from revengai.models.re_analysis_form import ReAnalysisForm from revengai.models.recent import Recent diff --git a/revengai/models/collection_list_item_body.py b/revengai/models/collection_list_item_body.py new file mode 100644 index 0000000..c9f29d8 --- /dev/null +++ b/revengai/models/collection_list_item_body.py @@ -0,0 +1,125 @@ +# 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, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CollectionListItemBody(BaseModel): + """ + CollectionListItemBody + """ # noqa: E501 + collection_id: StrictInt + collection_name: StrictStr + collection_owner: StrictStr + collection_scope: StrictStr + collection_size: StrictInt + collection_tags: Optional[List[StrictStr]] + creation: datetime + description: StrictStr + model_name: StrictStr + official_collection: StrictBool + team_id: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collection_id", "collection_name", "collection_owner", "collection_scope", "collection_size", "collection_tags", "creation", "description", "model_name", "official_collection", "team_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 CollectionListItemBody 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 collection_tags (nullable) is None + # and model_fields_set contains the field + if self.collection_tags is None and "collection_tags" in self.model_fields_set: + _dict['collection_tags'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CollectionListItemBody from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collection_id": obj.get("collection_id"), + "collection_name": obj.get("collection_name"), + "collection_owner": obj.get("collection_owner"), + "collection_scope": obj.get("collection_scope"), + "collection_size": obj.get("collection_size"), + "collection_tags": obj.get("collection_tags"), + "creation": obj.get("creation"), + "description": obj.get("description"), + "model_name": obj.get("model_name"), + "official_collection": obj.get("official_collection"), + "team_id": obj.get("team_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/get_collection_output_body.py b/revengai/models/get_collection_output_body.py new file mode 100644 index 0000000..98e2ee2 --- /dev/null +++ b/revengai/models/get_collection_output_body.py @@ -0,0 +1,144 @@ +# 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, StrictBool, StrictInt, StrictStr +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 GetCollectionOutputBody(BaseModel): + """ + GetCollectionOutputBody + """ # noqa: E501 + binaries: Optional[List[Binary]] = None + collection_id: StrictInt + collection_name: StrictStr + collection_scope: StrictStr + created_at: datetime + description: StrictStr + has_next_page: Optional[StrictBool] = None + model_id: StrictInt + page_number: Optional[StrictInt] = None + page_size: Optional[StrictInt] = None + tags: Optional[List[StrictStr]] = None + team_id: StrictInt + updated_at: datetime + user_id: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["binaries", "collection_id", "collection_name", "collection_scope", "created_at", "description", "has_next_page", "model_id", "page_number", "page_size", "tags", "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 GetCollectionOutputBody 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 + + # 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 GetCollectionOutputBody 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, + "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"), + "has_next_page": obj.get("has_next_page"), + "model_id": obj.get("model_id"), + "page_number": obj.get("page_number"), + "page_size": obj.get("page_size"), + "tags": obj.get("tags"), + "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/queue_position_response.py b/revengai/models/list_collections_output_body.py similarity index 65% rename from revengai/models/queue_position_response.py rename to revengai/models/list_collections_output_body.py index bf4e883..8532bdd 100644 --- a/revengai/models/queue_position_response.py +++ b/revengai/models/list_collections_output_body.py @@ -16,18 +16,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictInt -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from revengai.models.collection_list_item_body import CollectionListItemBody from typing import Optional, Set from typing_extensions import Self -class QueuePositionResponse(BaseModel): +class ListCollectionsOutputBody(BaseModel): """ - QueuePositionResponse + ListCollectionsOutputBody """ # noqa: E501 - queue_position: StrictInt = Field(description="Number of Processing analyses ahead of this one in the queue. 0 if this analysis is not Processing or has no analyses ahead of it.") + has_next_page: StrictBool + page_number: StrictInt + page_size: StrictInt + results: Optional[List[CollectionListItemBody]] additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["queue_position"] + __properties: ClassVar[List[str]] = ["has_next_page", "page_number", "page_size", "results"] model_config = ConfigDict( populate_by_name=True, @@ -47,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of QueuePositionResponse from a JSON string""" + """Create an instance of ListCollectionsOutputBody from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -70,16 +74,28 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item_results in self.results: + if _item_results: + _items.append(_item_results.to_dict()) + _dict['results'] = _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 results (nullable) is None + # and model_fields_set contains the field + if self.results is None and "results" in self.model_fields_set: + _dict['results'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of QueuePositionResponse from a dict""" + """Create an instance of ListCollectionsOutputBody from a dict""" if obj is None: return None @@ -87,7 +103,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "queue_position": obj.get("queue_position") + "has_next_page": obj.get("has_next_page"), + "page_number": obj.get("page_number"), + "page_size": obj.get("page_size"), + "results": [CollectionListItemBody.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None }) # store additional fields in additional_properties for _key in obj.keys():