diff --git a/qase-api-v2-client/README.md b/qase-api-v2-client/README.md index 9744fc9b..488d0a11 100644 --- a/qase-api-v2-client/README.md +++ b/qase-api-v2-client/README.md @@ -106,10 +106,17 @@ All URIs are relative to ** --------------|---------------------------------------------------------------|-----------------------------------------------|------------------------------------ *ResultsApi* | [**create_result_v2**](docs/ResultsApi.md#create_result_v2) | **POST** /{project_code}/run/{run_id}/result | (Beta) Create test run result *ResultsApi* | [**create_results_v2**](docs/ResultsApi.md#create_results_v2) | **POST** /{project_code}/run/{run_id}/results | (Beta) Bulk create test run result + *CustomFieldsApi* | [**get_custom_field_v2**](docs/CustomFieldsApi.md#get_custom_field_v2) | **GET** /custom-fields/{id} | Get custom field + *CustomFieldsApi* | [**get_custom_fields_v2**](docs/CustomFieldsApi.md#get_custom_fields_v2) | **GET** /custom-fields | Get custom fields ## Documentation For Models - [CreateResultsRequestV2](docs/CreateResultsRequestV2.md) +- [CustomField](docs/CustomField.md) +- [CustomFieldListResponse](docs/CustomFieldListResponse.md) +- [CustomFieldListResponseAllOfResult](docs/CustomFieldListResponseAllOfResult.md) +- [CustomFieldOption](docs/CustomFieldOption.md) +- [CustomFieldResponse](docs/CustomFieldResponse.md) - [RelationSuite](docs/RelationSuite.md) - [RelationSuiteItem](docs/RelationSuiteItem.md) - [ResultCreate](docs/ResultCreate.md) diff --git a/qase-api-v2-client/docs/CustomField.md b/qase-api-v2-client/docs/CustomField.md new file mode 100644 index 00000000..ce66c077 --- /dev/null +++ b/qase-api-v2-client/docs/CustomField.md @@ -0,0 +1,42 @@ +# CustomField + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**title** | **str** | | [optional] +**entity** | **str** | | [optional] +**type** | **str** | | [optional] +**placeholder** | **str** | | [optional] +**default_value** | **str** | | [optional] +**value** | [**List[CustomFieldOption]**](CustomFieldOption.md) | | [optional] +**is_required** | **bool** | | [optional] +**is_visible** | **bool** | | [optional] +**is_filterable** | **bool** | | [optional] +**is_enabled_for_all_projects** | **bool** | | [optional] +**created_at** | **datetime** | | [optional] +**updated_at** | **datetime** | | [optional] +**projects_codes** | **List[str]** | | [optional] + +## Example + +```python +from qase.api_client_v2.models.custom_field import CustomField + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomField from a JSON string +custom_field_instance = CustomField.from_json(json) +# print the JSON string representation of the object +print(CustomField.to_json()) + +# convert the object into a dict +custom_field_dict = custom_field_instance.to_dict() +# create an instance of CustomField from a dict +custom_field_from_dict = CustomField.from_dict(custom_field_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/qase-api-v2-client/docs/CustomFieldListResponse.md b/qase-api-v2-client/docs/CustomFieldListResponse.md new file mode 100644 index 00000000..e0623e5c --- /dev/null +++ b/qase-api-v2-client/docs/CustomFieldListResponse.md @@ -0,0 +1,30 @@ +# CustomFieldListResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **bool** | | [optional] +**result** | [**CustomFieldListResponseAllOfResult**](CustomFieldListResponseAllOfResult.md) | | [optional] + +## Example + +```python +from qase.api_client_v2.models.custom_field_list_response import CustomFieldListResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomFieldListResponse from a JSON string +custom_field_list_response_instance = CustomFieldListResponse.from_json(json) +# print the JSON string representation of the object +print(CustomFieldListResponse.to_json()) + +# convert the object into a dict +custom_field_list_response_dict = custom_field_list_response_instance.to_dict() +# create an instance of CustomFieldListResponse from a dict +custom_field_list_response_from_dict = CustomFieldListResponse.from_dict(custom_field_list_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/qase-api-v2-client/docs/CustomFieldListResponseAllOfResult.md b/qase-api-v2-client/docs/CustomFieldListResponseAllOfResult.md new file mode 100644 index 00000000..612ef5a0 --- /dev/null +++ b/qase-api-v2-client/docs/CustomFieldListResponseAllOfResult.md @@ -0,0 +1,32 @@ +# CustomFieldListResponseAllOfResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**total** | **int** | | [optional] +**filtered** | **int** | | [optional] +**count** | **int** | | [optional] +**entities** | [**List[CustomField]**](CustomField.md) | | [optional] + +## Example + +```python +from qase.api_client_v2.models.custom_field_list_response_all_of_result import CustomFieldListResponseAllOfResult + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomFieldListResponseAllOfResult from a JSON string +custom_field_list_response_all_of_result_instance = CustomFieldListResponseAllOfResult.from_json(json) +# print the JSON string representation of the object +print(CustomFieldListResponseAllOfResult.to_json()) + +# convert the object into a dict +custom_field_list_response_all_of_result_dict = custom_field_list_response_all_of_result_instance.to_dict() +# create an instance of CustomFieldListResponseAllOfResult from a dict +custom_field_list_response_all_of_result_from_dict = CustomFieldListResponseAllOfResult.from_dict(custom_field_list_response_all_of_result_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/qase-api-v2-client/docs/CustomFieldOption.md b/qase-api-v2-client/docs/CustomFieldOption.md new file mode 100644 index 00000000..f87c2be4 --- /dev/null +++ b/qase-api-v2-client/docs/CustomFieldOption.md @@ -0,0 +1,30 @@ +# CustomFieldOption + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**title** | **str** | | [optional] + +## Example + +```python +from qase.api_client_v2.models.custom_field_option import CustomFieldOption + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomFieldOption from a JSON string +custom_field_option_instance = CustomFieldOption.from_json(json) +# print the JSON string representation of the object +print(CustomFieldOption.to_json()) + +# convert the object into a dict +custom_field_option_dict = custom_field_option_instance.to_dict() +# create an instance of CustomFieldOption from a dict +custom_field_option_from_dict = CustomFieldOption.from_dict(custom_field_option_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/qase-api-v2-client/docs/CustomFieldResponse.md b/qase-api-v2-client/docs/CustomFieldResponse.md new file mode 100644 index 00000000..4020b5d2 --- /dev/null +++ b/qase-api-v2-client/docs/CustomFieldResponse.md @@ -0,0 +1,30 @@ +# CustomFieldResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **bool** | | [optional] +**result** | [**CustomField**](CustomField.md) | | [optional] + +## Example + +```python +from qase.api_client_v2.models.custom_field_response import CustomFieldResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomFieldResponse from a JSON string +custom_field_response_instance = CustomFieldResponse.from_json(json) +# print the JSON string representation of the object +print(CustomFieldResponse.to_json()) + +# convert the object into a dict +custom_field_response_dict = custom_field_response_instance.to_dict() +# create an instance of CustomFieldResponse from a dict +custom_field_response_from_dict = CustomFieldResponse.from_dict(custom_field_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/qase-api-v2-client/docs/CustomFieldsApi.md b/qase-api-v2-client/docs/CustomFieldsApi.md new file mode 100644 index 00000000..223c7238 --- /dev/null +++ b/qase-api-v2-client/docs/CustomFieldsApi.md @@ -0,0 +1,185 @@ +# qase.api_client_v2.CustomFieldsApi + +All URIs are relative to *https://api.qase.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_custom_field_v2**](CustomFieldsApi.md#get_custom_field_v2) | **GET** /custom_field/{id} | Get Custom Field +[**get_custom_fields_v2**](CustomFieldsApi.md#get_custom_fields_v2) | **GET** /custom_field | Get all Custom Fields + + +# **get_custom_field_v2** +> CustomFieldResponse get_custom_field_v2(id) + +Get Custom Field + +This method allows to retrieve custom field. + + +### Example + +* Api Key Authentication (TokenAuth): + +```python +import qase.api_client_v2 +from qase.api_client_v2.models.custom_field_response import CustomFieldResponse +from qase.api_client_v2.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.qase.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = qase.api_client_v2.Configuration( + host = "https://api.qase.io/v2" +) + +# 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: TokenAuth +configuration.api_key['TokenAuth'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['TokenAuth'] = 'Bearer' + +# Enter a context with an instance of the API client +with qase.api_client_v2.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = qase.api_client_v2.CustomFieldsApi(api_client) + id = 56 # int | Identifier. + + try: + # Get Custom Field + api_response = api_instance.get_custom_field_v2(id) + print("The response of CustomFieldsApi->get_custom_field_v2:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomFieldsApi->get_custom_field_v2: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **int**| Identifier. | + +### Return type + +[**CustomFieldResponse**](CustomFieldResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A Custom Field. | - | +**400** | Bad Request. | - | +**401** | Unauthorized. | - | +**403** | Forbidden. | - | +**404** | Not Found. | - | +**429** | Too Many Requests. | - | + +[[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_custom_fields_v2** +> CustomFieldListResponse get_custom_fields_v2(entity=entity, type=type, limit=limit, offset=offset) + +Get all Custom Fields + +This method allows to retrieve and filter custom fields. + + +### Example + +* Api Key Authentication (TokenAuth): + +```python +import qase.api_client_v2 +from qase.api_client_v2.models.custom_field_list_response import CustomFieldListResponse +from qase.api_client_v2.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.qase.io/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = qase.api_client_v2.Configuration( + host = "https://api.qase.io/v2" +) + +# 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: TokenAuth +configuration.api_key['TokenAuth'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['TokenAuth'] = 'Bearer' + +# Enter a context with an instance of the API client +with qase.api_client_v2.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = qase.api_client_v2.CustomFieldsApi(api_client) + entity = 'entity_example' # str | (optional) + type = 'type_example' # str | (optional) + limit = 10 # int | A number of entities in result set. (optional) (default to 10) + offset = 0 # int | How many entities should be skipped. (optional) (default to 0) + + try: + # Get all Custom Fields + api_response = api_instance.get_custom_fields_v2(entity=entity, type=type, limit=limit, offset=offset) + print("The response of CustomFieldsApi->get_custom_fields_v2:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CustomFieldsApi->get_custom_fields_v2: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **entity** | **str**| | [optional] + **type** | **str**| | [optional] + **limit** | **int**| A number of entities in result set. | [optional] [default to 10] + **offset** | **int**| How many entities should be skipped. | [optional] [default to 0] + +### Return type + +[**CustomFieldListResponse**](CustomFieldListResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Custom Field list. | - | +**400** | Bad Request. | - | +**401** | Unauthorized. | - | +**403** | Forbidden. | - | +**429** | Too Many Requests. | - | + +[[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/qase-api-v2-client/pyproject.toml b/qase-api-v2-client/pyproject.toml index 44394a3a..6f92cee0 100644 --- a/qase-api-v2-client/pyproject.toml +++ b/qase-api-v2-client/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-api-v2-client" -version = "2.0.0" +version = "2.0.1" description = "Qase TestOps API V2 client for Python" readme = "README.md" authors = [{name = "Qase Team", email = "support@qase.io"}] diff --git a/qase-api-v2-client/src/qase/api_client_v2/__init__.py b/qase-api-v2-client/src/qase/api_client_v2/__init__.py index a45ab66f..2728d51e 100644 --- a/qase-api-v2-client/src/qase/api_client_v2/__init__.py +++ b/qase-api-v2-client/src/qase/api_client_v2/__init__.py @@ -19,6 +19,7 @@ # Define package exports __all__ = [ + "CustomFieldsApi", "ResultsApi", "ApiResponse", "ApiClient", @@ -31,6 +32,11 @@ "ApiException", "BaseResponse", "CreateResultsRequestV2", + "CustomField", + "CustomFieldListResponse", + "CustomFieldListResponseAllOfResult", + "CustomFieldOption", + "CustomFieldResponse", "RelationSuite", "RelationSuiteItem", "ResultCreate", @@ -49,6 +55,7 @@ if __import__("typing").TYPE_CHECKING: # import apis into sdk package + from qase.api_client_v2.api.custom_fields_api import CustomFieldsApi as CustomFieldsApi from qase.api_client_v2.api.results_api import ResultsApi as ResultsApi # import ApiClient @@ -65,6 +72,11 @@ # import models into sdk package from qase.api_client_v2.models.base_response import BaseResponse as BaseResponse from qase.api_client_v2.models.create_results_request_v2 import CreateResultsRequestV2 as CreateResultsRequestV2 + from qase.api_client_v2.models.custom_field import CustomField as CustomField + from qase.api_client_v2.models.custom_field_list_response import CustomFieldListResponse as CustomFieldListResponse + from qase.api_client_v2.models.custom_field_list_response_all_of_result import CustomFieldListResponseAllOfResult as CustomFieldListResponseAllOfResult + from qase.api_client_v2.models.custom_field_option import CustomFieldOption as CustomFieldOption + from qase.api_client_v2.models.custom_field_response import CustomFieldResponse as CustomFieldResponse from qase.api_client_v2.models.relation_suite import RelationSuite as RelationSuite from qase.api_client_v2.models.relation_suite_item import RelationSuiteItem as RelationSuiteItem from qase.api_client_v2.models.result_create import ResultCreate as ResultCreate @@ -89,6 +101,7 @@ ("__version__", __version__), ("__all__", __all__), """# import apis into sdk package +from qase.api_client_v2.api.custom_fields_api import CustomFieldsApi as CustomFieldsApi from qase.api_client_v2.api.results_api import ResultsApi as ResultsApi # import ApiClient @@ -105,6 +118,11 @@ # import models into sdk package from qase.api_client_v2.models.base_response import BaseResponse as BaseResponse from qase.api_client_v2.models.create_results_request_v2 import CreateResultsRequestV2 as CreateResultsRequestV2 +from qase.api_client_v2.models.custom_field import CustomField as CustomField +from qase.api_client_v2.models.custom_field_list_response import CustomFieldListResponse as CustomFieldListResponse +from qase.api_client_v2.models.custom_field_list_response_all_of_result import CustomFieldListResponseAllOfResult as CustomFieldListResponseAllOfResult +from qase.api_client_v2.models.custom_field_option import CustomFieldOption as CustomFieldOption +from qase.api_client_v2.models.custom_field_response import CustomFieldResponse as CustomFieldResponse from qase.api_client_v2.models.relation_suite import RelationSuite as RelationSuite from qase.api_client_v2.models.relation_suite_item import RelationSuiteItem as RelationSuiteItem from qase.api_client_v2.models.result_create import ResultCreate as ResultCreate diff --git a/qase-api-v2-client/src/qase/api_client_v2/api/__init__.py b/qase-api-v2-client/src/qase/api_client_v2/api/__init__.py index 1c4e5149..c049cb04 100644 --- a/qase-api-v2-client/src/qase/api_client_v2/api/__init__.py +++ b/qase-api-v2-client/src/qase/api_client_v2/api/__init__.py @@ -2,6 +2,7 @@ if __import__("typing").TYPE_CHECKING: # import apis into api package + from qase.api_client_v2.api.custom_fields_api import CustomFieldsApi from qase.api_client_v2.api.results_api import ResultsApi else: @@ -11,6 +12,7 @@ LazyModule( *as_package(__file__), """# import apis into api package +from qase.api_client_v2.api.custom_fields_api import CustomFieldsApi from qase.api_client_v2.api.results_api import ResultsApi """, diff --git a/qase-api-v2-client/src/qase/api_client_v2/api/custom_fields_api.py b/qase-api-v2-client/src/qase/api_client_v2/api/custom_fields_api.py new file mode 100644 index 00000000..99aff216 --- /dev/null +++ b/qase-api-v2-client/src/qase/api_client_v2/api/custom_fields_api.py @@ -0,0 +1,643 @@ +# coding: utf-8 + +""" + Qase.io TestOps API v2 + + Qase TestOps API v2 Specification. + + The version of the OpenAPI document: 2.0.0 + Contact: support@qase.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr, field_validator +from typing import Optional +from typing_extensions import Annotated +from qase.api_client_v2.models.custom_field_list_response import CustomFieldListResponse +from qase.api_client_v2.models.custom_field_response import CustomFieldResponse + +from qase.api_client_v2.api_client import ApiClient, RequestSerialized +from qase.api_client_v2.api_response import ApiResponse +from qase.api_client_v2.rest import RESTResponseType + + +class CustomFieldsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_custom_field_v2( + self, + id: Annotated[StrictInt, Field(description="Identifier.")], + _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, + ) -> CustomFieldResponse: + """Get Custom Field + + This method allows to retrieve custom field. + + :param id: Identifier. (required) + :type 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_custom_field_v2_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomFieldResponse", + '400': None, + '401': None, + '403': None, + '404': None, + '429': None, + } + 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_custom_field_v2_with_http_info( + self, + id: Annotated[StrictInt, Field(description="Identifier.")], + _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[CustomFieldResponse]: + """Get Custom Field + + This method allows to retrieve custom field. + + :param id: Identifier. (required) + :type 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_custom_field_v2_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomFieldResponse", + '400': None, + '401': None, + '403': None, + '404': None, + '429': None, + } + 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_custom_field_v2_without_preload_content( + self, + id: Annotated[StrictInt, Field(description="Identifier.")], + _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 Custom Field + + This method allows to retrieve custom field. + + :param id: Identifier. (required) + :type 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_custom_field_v2_serialize( + id=id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomFieldResponse", + '400': None, + '401': None, + '403': None, + '404': None, + '429': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_custom_field_v2_serialize( + self, + 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 id is not None: + _path_params['id'] = 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] = [ + 'TokenAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/custom_field/{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 get_custom_fields_v2( + self, + entity: Optional[StrictStr] = None, + type: Optional[StrictStr] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="A number of entities in result set.")] = None, + offset: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=0)]], Field(description="How many entities should be skipped.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomFieldListResponse: + """Get all Custom Fields + + This method allows to retrieve and filter custom fields. + + :param entity: + :type entity: str + :param type: + :type type: str + :param limit: A number of entities in result set. + :type limit: int + :param offset: How many entities should be skipped. + :type offset: 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_custom_fields_v2_serialize( + entity=entity, + type=type, + limit=limit, + offset=offset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomFieldListResponse", + '400': None, + '401': None, + '403': None, + '429': None, + } + 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_custom_fields_v2_with_http_info( + self, + entity: Optional[StrictStr] = None, + type: Optional[StrictStr] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="A number of entities in result set.")] = None, + offset: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=0)]], Field(description="How many entities should be skipped.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomFieldListResponse]: + """Get all Custom Fields + + This method allows to retrieve and filter custom fields. + + :param entity: + :type entity: str + :param type: + :type type: str + :param limit: A number of entities in result set. + :type limit: int + :param offset: How many entities should be skipped. + :type offset: 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_custom_fields_v2_serialize( + entity=entity, + type=type, + limit=limit, + offset=offset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomFieldListResponse", + '400': None, + '401': None, + '403': None, + '429': None, + } + 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_custom_fields_v2_without_preload_content( + self, + entity: Optional[StrictStr] = None, + type: Optional[StrictStr] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="A number of entities in result set.")] = None, + offset: Annotated[Optional[Annotated[int, Field(le=100000, strict=True, ge=0)]], Field(description="How many entities should be skipped.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get all Custom Fields + + This method allows to retrieve and filter custom fields. + + :param entity: + :type entity: str + :param type: + :type type: str + :param limit: A number of entities in result set. + :type limit: int + :param offset: How many entities should be skipped. + :type offset: 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_custom_fields_v2_serialize( + entity=entity, + type=type, + limit=limit, + offset=offset, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomFieldListResponse", + '400': None, + '401': None, + '403': None, + '429': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_custom_fields_v2_serialize( + self, + entity, + type, + limit, + offset, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if entity is not None: + + _query_params.append(('entity', entity)) + + if type is not None: + + _query_params.append(('type', type)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if offset is not None: + + _query_params.append(('offset', offset)) + + # 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] = [ + 'TokenAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/custom_field', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/qase-api-v2-client/src/qase/api_client_v2/models/__init__.py b/qase-api-v2-client/src/qase/api_client_v2/models/__init__.py index 9e2213ed..5420cc54 100644 --- a/qase-api-v2-client/src/qase/api_client_v2/models/__init__.py +++ b/qase-api-v2-client/src/qase/api_client_v2/models/__init__.py @@ -18,6 +18,11 @@ # import models into model package from qase.api_client_v2.models.base_response import BaseResponse from qase.api_client_v2.models.create_results_request_v2 import CreateResultsRequestV2 + from qase.api_client_v2.models.custom_field import CustomField + from qase.api_client_v2.models.custom_field_list_response import CustomFieldListResponse + from qase.api_client_v2.models.custom_field_list_response_all_of_result import CustomFieldListResponseAllOfResult + from qase.api_client_v2.models.custom_field_option import CustomFieldOption + from qase.api_client_v2.models.custom_field_response import CustomFieldResponse from qase.api_client_v2.models.relation_suite import RelationSuite from qase.api_client_v2.models.relation_suite_item import RelationSuiteItem from qase.api_client_v2.models.result_create import ResultCreate @@ -42,6 +47,11 @@ """# import models into model package from qase.api_client_v2.models.base_response import BaseResponse from qase.api_client_v2.models.create_results_request_v2 import CreateResultsRequestV2 +from qase.api_client_v2.models.custom_field import CustomField +from qase.api_client_v2.models.custom_field_list_response import CustomFieldListResponse +from qase.api_client_v2.models.custom_field_list_response_all_of_result import CustomFieldListResponseAllOfResult +from qase.api_client_v2.models.custom_field_option import CustomFieldOption +from qase.api_client_v2.models.custom_field_response import CustomFieldResponse from qase.api_client_v2.models.relation_suite import RelationSuite from qase.api_client_v2.models.relation_suite_item import RelationSuiteItem from qase.api_client_v2.models.result_create import ResultCreate diff --git a/qase-api-v2-client/src/qase/api_client_v2/models/custom_field.py b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field.py new file mode 100644 index 00000000..53166b90 --- /dev/null +++ b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field.py @@ -0,0 +1,138 @@ +# coding: utf-8 + +""" + Qase.io TestOps API v2 + + Qase TestOps API v2 Specification. + + The version of the OpenAPI document: 2.0.0 + Contact: support@qase.io + 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 qase.api_client_v2.models.custom_field_option import CustomFieldOption +from typing import Optional, Set +from typing_extensions import Self + +class CustomField(BaseModel): + """ + CustomField + """ # noqa: E501 + id: Optional[StrictInt] = None + title: Optional[StrictStr] = None + entity: Optional[StrictStr] = None + type: Optional[StrictStr] = None + placeholder: Optional[StrictStr] = None + default_value: Optional[StrictStr] = None + value: Optional[List[CustomFieldOption]] = None + is_required: Optional[StrictBool] = None + is_visible: Optional[StrictBool] = None + is_filterable: Optional[StrictBool] = None + is_enabled_for_all_projects: Optional[StrictBool] = None + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + projects_codes: Optional[List[StrictStr]] = None + __properties: ClassVar[List[str]] = ["id", "title", "entity", "type", "placeholder", "default_value", "value", "is_required", "is_visible", "is_filterable", "is_enabled_for_all_projects", "created_at", "updated_at", "projects_codes"] + + 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 CustomField from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in value (list) + _items = [] + if self.value: + for _item_value in self.value: + if _item_value: + _items.append(_item_value.to_dict()) + _dict['value'] = _items + # set to None if placeholder (nullable) is None + # and model_fields_set contains the field + if self.placeholder is None and "placeholder" in self.model_fields_set: + _dict['placeholder'] = None + + # set to None if default_value (nullable) is None + # and model_fields_set contains the field + if self.default_value is None and "default_value" in self.model_fields_set: + _dict['default_value'] = None + + # set to None if value (nullable) is None + # and model_fields_set contains the field + if self.value is None and "value" in self.model_fields_set: + _dict['value'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomField from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title"), + "entity": obj.get("entity"), + "type": obj.get("type"), + "placeholder": obj.get("placeholder"), + "default_value": obj.get("default_value"), + "value": [CustomFieldOption.from_dict(_item) for _item in obj["value"]] if obj.get("value") is not None else None, + "is_required": obj.get("is_required"), + "is_visible": obj.get("is_visible"), + "is_filterable": obj.get("is_filterable"), + "is_enabled_for_all_projects": obj.get("is_enabled_for_all_projects"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "projects_codes": obj.get("projects_codes") + }) + return _obj + + diff --git a/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_list_response.py b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_list_response.py new file mode 100644 index 00000000..509eb1d7 --- /dev/null +++ b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_list_response.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Qase.io TestOps API v2 + + Qase TestOps API v2 Specification. + + The version of the OpenAPI document: 2.0.0 + Contact: support@qase.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from qase.api_client_v2.models.custom_field_list_response_all_of_result import CustomFieldListResponseAllOfResult +from typing import Optional, Set +from typing_extensions import Self + +class CustomFieldListResponse(BaseModel): + """ + CustomFieldListResponse + """ # noqa: E501 + status: Optional[StrictBool] = None + result: Optional[CustomFieldListResponseAllOfResult] = None + __properties: ClassVar[List[str]] = ["status", "result"] + + 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 CustomFieldListResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomFieldListResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status"), + "result": CustomFieldListResponseAllOfResult.from_dict(obj["result"]) if obj.get("result") is not None else None + }) + return _obj + + diff --git a/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_list_response_all_of_result.py b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_list_response_all_of_result.py new file mode 100644 index 00000000..c43fed5f --- /dev/null +++ b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_list_response_all_of_result.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + Qase.io TestOps API v2 + + Qase TestOps API v2 Specification. + + The version of the OpenAPI document: 2.0.0 + Contact: support@qase.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from qase.api_client_v2.models.custom_field import CustomField +from typing import Optional, Set +from typing_extensions import Self + +class CustomFieldListResponseAllOfResult(BaseModel): + """ + CustomFieldListResponseAllOfResult + """ # noqa: E501 + total: Optional[StrictInt] = None + filtered: Optional[StrictInt] = None + count: Optional[StrictInt] = None + entities: Optional[List[CustomField]] = None + __properties: ClassVar[List[str]] = ["total", "filtered", "count", "entities"] + + 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 CustomFieldListResponseAllOfResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in entities (list) + _items = [] + if self.entities: + for _item_entities in self.entities: + if _item_entities: + _items.append(_item_entities.to_dict()) + _dict['entities'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomFieldListResponseAllOfResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "total": obj.get("total"), + "filtered": obj.get("filtered"), + "count": obj.get("count"), + "entities": [CustomField.from_dict(_item) for _item in obj["entities"]] if obj.get("entities") is not None else None + }) + return _obj + + diff --git a/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_option.py b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_option.py new file mode 100644 index 00000000..5154b494 --- /dev/null +++ b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_option.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Qase.io TestOps API v2 + + Qase TestOps API v2 Specification. + + The version of the OpenAPI document: 2.0.0 + Contact: support@qase.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CustomFieldOption(BaseModel): + """ + CustomFieldOption + """ # noqa: E501 + id: Optional[StrictInt] = None + title: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "title"] + + 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 CustomFieldOption from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomFieldOption from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "title": obj.get("title") + }) + return _obj + + diff --git a/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_response.py b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_response.py new file mode 100644 index 00000000..1c2d6bf7 --- /dev/null +++ b/qase-api-v2-client/src/qase/api_client_v2/models/custom_field_response.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Qase.io TestOps API v2 + + Qase TestOps API v2 Specification. + + The version of the OpenAPI document: 2.0.0 + Contact: support@qase.io + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool +from typing import Any, ClassVar, Dict, List, Optional +from qase.api_client_v2.models.custom_field import CustomField +from typing import Optional, Set +from typing_extensions import Self + +class CustomFieldResponse(BaseModel): + """ + CustomFieldResponse + """ # noqa: E501 + status: Optional[StrictBool] = None + result: Optional[CustomField] = None + __properties: ClassVar[List[str]] = ["status", "result"] + + 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 CustomFieldResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of result + if self.result: + _dict['result'] = self.result.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomFieldResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status"), + "result": CustomField.from_dict(obj["result"]) if obj.get("result") is not None else None + }) + return _obj + +