# coding: utf-8

"""
    XingChen 开放接口定义

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v2
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import re  # noqa: F401
import io
import warnings
from typing import List, Optional

from pydantic import validate_arguments, ValidationError

from typing_extensions import Annotated
from pydantic import Field, StrictInt, StrictStr

from xingchen.models.character_create_dto import CharacterCreateDTO
from xingchen.models.character_desc_generated_request import CharacterDescGeneratedRequest
from xingchen.models.character_query_dto import CharacterQueryDTO
from xingchen.models.character_update_dto import CharacterUpdateDTO
from xingchen.models.character_version_create_or_update_dto import CharacterVersionCreateOrUpdateDTO
from xingchen.models.platform_plugin import PlatformPlugin
from xingchen.models.reject_answer_plugin import RejectAnswerPlugin
from xingchen.models.result_dto_boolean import ResultDTOBoolean
from xingchen.models.result_dto_character_desc_dto import ResultDTOCharacterDescDTO
from xingchen.models.result_dto_character_dto import ResultDTOCharacterDTO
from xingchen.models.result_dto_character_key import ResultDTOCharacterKey
from xingchen.models.result_dto_list_character_dto import ResultDTOListCharacterDTO
from xingchen.models.result_dto_page_result_character_dto import ResultDTOPageResultCharacterDTO

from xingchen.api_client import ApiClient
from xingchen.api_response import ApiResponse
from xingchen.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)
from xingchen.models.text_to_image_plugin import TextToImagePlugin


class CharacterApiSub:
    """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_arguments
    def character_details(self, character_id: Annotated[StrictStr, Field(..., description="角色ID")],
                          **kwargs) -> ResultDTOCharacterDTO:  # noqa: E501
        """角色详情  # noqa: E501

        获取角色详细信息  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.character_details(character_id, 1, async_req=True)
        >>> result = thread.get()

        :param character_id: 角色ID (required)
        :type character_id: str
        :param version: 角色版本 (required)
        :type version: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOCharacterDTO
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the character_details_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.character_details_with_http_info(character_id, 1, **kwargs)  # noqa: E501

    @validate_arguments
    def character_details_with_http_info(self, character_id: Annotated[StrictStr, Field(..., description="角色ID")],
                                         version: Annotated[StrictInt, Field(..., description="角色版本")],
                                         **kwargs) -> ApiResponse:  # noqa: E501
        """角色详情  # noqa: E501

        获取角色详细信息  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.character_details_with_http_info(character_id, version, async_req=True)
        >>> result = thread.get()

        :param character_id: 角色ID (required)
        :type character_id: str
        :param version: 角色版本 (required)
        :type version: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOCharacterDTO, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'character_id',
            'version'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method character_details" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('character_id') is not None:  # noqa: E501
            _query_params.append(('characterId', _params['character_id']))

        if _params.get('version') is not None:  # noqa: E501
            _query_params.append(('version', _params['version']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOCharacterDTO",
        }

        return self.api_client.call_api(
            '/{api_version}/api/character/details'.format(api_version=self.api_client.configuration.api_version), 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def create(self, character_create_dto: CharacterCreateDTO, **kwargs) -> ResultDTOCharacterKey:  # noqa: E501
        """创建角色  # noqa: E501

        基于角色名称、人设和对话示例定义角色，并返回角色ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.create(character_create_dto, async_req=True)
        >>> result = thread.get()

        :param character_create_dto: (required)
        :type character_create_dto: CharacterCreateDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOCharacterKey
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the create_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.create_with_http_info(character_create_dto, **kwargs)  # noqa: E501

    @validate_arguments
    def create_with_http_info(self, character_create_dto: CharacterCreateDTO, **kwargs) -> ApiResponse:  # noqa: E501
        """创建角色  # noqa: E501

        基于角色名称、人设和对话示例定义角色，并返回角色ID  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.create_with_http_info(character_create_dto, async_req=True)
        >>> result = thread.get()

        :param character_create_dto: (required)
        :type character_create_dto: CharacterCreateDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOCharacterKey, status_code(int), headers(HTTPHeaderDict))
        """
        if character_create_dto.advanced_config is not None:
            self.pre_check_plugin_process(character_create_dto.advanced_config.platform_plugins)
        _params = locals()

        _all_params = [
            'character_create_dto'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['character_create_dto'] is not None:
            _body_params = _params['character_create_dto']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
                                          self.api_client.select_header_content_type(
                                              ['application/json']))
        if _content_types_list:
            _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOCharacterKey",
        }

        return self.api_client.call_api(
            '/{0}/api/character/create'.format(self.api_client.api_version()), 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def create_or_update_version(self, character_version_create_or_update_dto: Annotated[
        CharacterVersionCreateOrUpdateDTO, Field(..., description="待更新的角色信息")],
                                 **kwargs) -> ApiResponse:  # noqa: E501
        """创建或更新角色版本  # noqa: E501

        必须字段：characterId 和 version。返回角色版本详情。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.create_or_update_version(character_version_create_or_update_dto, async_req=True)
        >>> result = thread.get()

        :param character_version_create_or_update_dto: 待更新的角色信息 (required)
        :type character_version_create_or_update_dto: CharacterVersionCreateOrUpdateDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOCharacterDTO
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the create_or_update_version_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.create_or_update_version_with_http_info(character_version_create_or_update_dto,
                                                            **kwargs)  # noqa: E501

    @validate_arguments
    def create_or_update_version_with_http_info(self, character_version_create_or_update_dto: Annotated[
        CharacterVersionCreateOrUpdateDTO, Field(..., description="待更新的角色信息")],
                                                **kwargs) -> ApiResponse:  # noqa: E501
        """创建或更新角色版本  # noqa: E501

        必须字段：characterId 和 version。返回角色版本详情。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.create_or_update_version_with_http_info(character_version_create_or_update_dto, async_req=True)
        >>> result = thread.get()

        :param character_version_create_or_update_dto: 待更新的角色信息 (required)
        :type character_version_create_or_update_dto: CharacterVersionCreateOrUpdateDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOCharacterDTO, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'character_version_create_or_update_dto'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_or_update_version" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['character_version_create_or_update_dto'] is not None:
            _body_params = _params['character_version_create_or_update_dto']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
                                          self.api_client.select_header_content_type(
                                              ['application/json']))
        if _content_types_list:
            _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOCharacterDTO",
        }

        return self.api_client.call_api(
            '/{0}/api/character/createOrUpdateVersion'.format(self.api_client.api_version()), 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def delete(self, character_id: Annotated[StrictStr, Field(..., description="待删除的 characterId")],
               **kwargs) -> ResultDTOBoolean:  # noqa: E501
        """删除角色  # noqa: E501

        （逻辑）删除 character。返回成功或失败。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.delete(character_id, 1, async_req=True)
        >>> result = thread.get()

        :param character_id: 待删除的 characterId (required)
        :type character_id: str
        :param version: 待删除的版本 (required)
        :type version: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOBoolean
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the delete_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.delete_with_http_info(character_id, 1, **kwargs)  # noqa: E501

    @validate_arguments
    def delete_with_http_info(self, character_id: Annotated[StrictStr, Field(..., description="待删除的 characterId")],
                              version: Annotated[StrictInt, Field(..., description="待删除的版本")],
                              **kwargs) -> ApiResponse:  # noqa: E501
        """删除角色  # noqa: E501

        （逻辑）删除 character。返回成功或失败。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.delete_with_http_info(character_id, version, async_req=True)
        >>> result = thread.get()

        :param character_id: 待删除的 characterId (required)
        :type character_id: str
        :param version: 待删除的版本 (required)
        :type version: int
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOBoolean, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'character_id',
            'version'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('character_id') is not None:  # noqa: E501
            _query_params.append(('characterId', _params['character_id']))

        if _params.get('version') is not None:  # noqa: E501
            _query_params.append(('version', _params['version']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = {
            'characterId': _params.get('character_id'),
            'version': _params.get('version')
        }

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501
        _header_params['Content-Type'] = self.api_client.select_header_content_type(['application/json'])

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOBoolean",
        }

        return self.api_client.call_api(
            '/{0}/api/character/delete'.format(self.api_client.api_version()), 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def list_character_versions(self, character_id: Annotated[StrictStr, Field(..., description="角色 characterId")],
                                **kwargs) -> ResultDTOListCharacterDTO:  # noqa: E501
        """角色版本列表  # noqa: E501

        获取角色版本列表  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_character_versions(character_id, async_req=True)
        >>> result = thread.get()

        :param character_id: 角色 characterId (required)
        :type character_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOListCharacterDTO
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the list_character_versions_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.list_character_versions_with_http_info(character_id, **kwargs)  # noqa: E501

    @validate_arguments
    def list_character_versions_with_http_info(self, character_id: Annotated[
        StrictStr, Field(..., description="角色 characterId")], **kwargs) -> ApiResponse:  # noqa: E501
        """角色版本列表  # noqa: E501

        获取角色版本列表  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_character_versions_with_http_info(character_id, async_req=True)
        >>> result = thread.get()

        :param character_id: 角色 characterId (required)
        :type character_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOListCharacterDTO, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'character_id'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_character_versions" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['character_id']:
            _path_params['characterId'] = _params['character_id']

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOListCharacterDTO",
        }

        version = self.api_client.api_version()
        if not version or version.__eq__('v2'):
            _header_params['x-fag-servicename'] = 'aca-character-versions'

        return self.api_client.call_api(
            '/' + version + '/api/character/versions/{characterId}', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def recommend_character_version(self,
                                    character_id: Annotated[StrictStr, Field(..., description="角色 characterId")],
                                    **kwargs) -> ResultDTOCharacterDTO:  # noqa: E501
        """角色版本列表  # noqa: E501

        获取角色版本列表  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.recommend_character_version(character_id, async_req=True)
        >>> result = thread.get()

        :param character_id: 角色 characterId (required)
        :type character_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOCharacterDTO
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the recommend_character_version_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.recommend_character_version_with_http_info(character_id, **kwargs)  # noqa: E501

    @validate_arguments
    def recommend_character_version_with_http_info(self, character_id: Annotated[
        StrictStr, Field(..., description="角色 characterId")], **kwargs) -> ApiResponse:  # noqa: E501
        """角色版本列表  # noqa: E501

        获取角色版本列表  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.recommend_character_version_with_http_info(character_id, async_req=True)
        >>> result = thread.get()

        :param character_id: 角色 characterId (required)
        :type character_id: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOCharacterDTO, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'character_id'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method recommend_character_version" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['character_id']:
            _path_params['characterId'] = _params['character_id']

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOCharacterDTO",
        }

        version = self.api_client.api_version()
        if not version or version.__eq__('v2'):
            _header_params['x-fag-servicename'] = 'aca-character-version-recommend'

        return self.api_client.call_api(
            '/' + self.api_client.api_version() + '/api/character/newversion/recommend/{characterId}', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def search(self, character_query_dto: Annotated[CharacterQueryDTO, Field(..., description="查询条件")],
               **kwargs) -> ResultDTOPageResultCharacterDTO:  # noqa: E501
        """查询角色  # noqa: E501

        查询角色： - 可以指定的查询字段，and 关系：    - 角色名称：左匹配    - 查询范围      - my - 只查询我创建的角色      - public - 查询平台开放的角色      - pre_configured - 预制角色 - 可以指定一定的排序规则，如更新时间倒排。 - 搜索结果为 角色详情。 - 支持分页。   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.search(character_query_dto, async_req=True)
        >>> result = thread.get()

        :param character_query_dto: 查询条件 (required)
        :type character_query_dto: CharacterQueryDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOPageResultCharacterDTO
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the search_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.search_with_http_info(character_query_dto, **kwargs)  # noqa: E501

    @validate_arguments
    def search_with_http_info(self,
                              character_query_dto: Annotated[CharacterQueryDTO, Field(..., description="查询条件")],
                              **kwargs) -> ApiResponse:  # noqa: E501
        """查询角色  # noqa: E501

        查询角色： - 可以指定的查询字段，and 关系：    - 角色名称：左匹配    - 查询范围      - my - 只查询我创建的角色      - public - 查询平台开放的角色      - pre_configured - 预制角色 - 可以指定一定的排序规则，如更新时间倒排。 - 搜索结果为 角色详情。 - 支持分页。   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.search_with_http_info(character_query_dto, async_req=True)
        >>> result = thread.get()

        :param character_query_dto: 查询条件 (required)
        :type character_query_dto: CharacterQueryDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOPageResultCharacterDTO, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'character_query_dto'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method search" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['character_query_dto'] is not None:
            _body_params = _params['character_query_dto']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
                                          self.api_client.select_header_content_type(
                                              ['application/json']))
        if _content_types_list:
            _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOPageResultCharacterDTO",
        }

        return self.api_client.call_api(
            '/{0}/api/character/search'.format(self.api_client.api_version()), 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_arguments
    def update(self, character_update_dto: Annotated[CharacterUpdateDTO, Field(..., description="待更新的角色信息")],
               **kwargs) -> ResultDTOBoolean:  # noqa: E501
        """更新角色信息  # noqa: E501

        必须字段：characterId。返回成功或失败。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.update(character_update_dto, async_req=True)
        >>> result = thread.get()

        :param character_update_dto: 待更新的角色信息 (required)
        :type character_update_dto: CharacterUpdateDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResultDTOBoolean
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the update_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.update_with_http_info(character_update_dto, **kwargs)  # noqa: E501

    @validate_arguments
    def update_with_http_info(self, character_update_dto: Annotated[
        CharacterUpdateDTO, Field(..., description="待更新的角色信息")], **kwargs) -> ApiResponse:  # noqa: E501
        """更新角色信息  # noqa: E501

        必须字段：characterId。返回成功或失败。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.update_with_http_info(character_update_dto, async_req=True)
        >>> result = thread.get()

        :param character_update_dto: 待更新的角色信息 (required)
        :type character_update_dto: CharacterUpdateDTO
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResultDTOBoolean, status_code(int), headers(HTTPHeaderDict))
        """
        if character_update_dto.advanced_config is not None:
            self.pre_check_plugin_process(platform_plugins=character_update_dto.advanced_config.platform_plugins)

        _params = locals()

        _all_params = [
            'character_update_dto'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['character_update_dto'] is not None:
            _body_params = _params['character_update_dto']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
                                          self.api_client.select_header_content_type(
                                              ['application/json']))
        if _content_types_list:
            _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOBoolean",
        }

        return self.api_client.call_api(
            '/{0}/api/character/update'.format(self.api_client.api_version()), 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @staticmethod
    def pre_check_plugin_process(platform_plugins: List[PlatformPlugin]):
        if platform_plugins is None or len(platform_plugins) == 0:
            return
        for platform_plugin in platform_plugins:
            if isinstance(platform_plugin, TextToImagePlugin):
                platform_plugin.enabled = False if platform_plugin.enabled is None else platform_plugin.enabled
                if not platform_plugin.name:
                    platform_plugin.name = "text_to_image_plugin"
                continue
            if isinstance(platform_plugin, RejectAnswerPlugin):
                platform_plugin.enabled = False if platform_plugin.enabled is None else platform_plugin.enabled
                if not platform_plugin.name:
                    platform_plugin.name = "reject_answer_plugin"
                continue
            raise TypeError("Wrong plugin class type")

    @validate_arguments
    def auto_generate_desc(self, character_desc_generate_request: CharacterDescGeneratedRequest,
                           **kwargs) -> ResultDTOCharacterDescDTO:  # noqa: E501
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the create_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        return self.auto_generate_desc_with_http_info(character_desc_generate_request, **kwargs)  # noqa: E501

    @validate_arguments
    def auto_generate_desc_with_http_info(self, character_desc_generate_request: CharacterDescGeneratedRequest,
                                          **kwargs) -> ApiResponse:  # noqa: E501

        _params = locals()

        _all_params = [
            'character_desc_generate_request'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method auto_generate_desc" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['character_desc_generate_request'] is not None:
            _body_params = _params['character_desc_generate_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['*/*'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
                                          self.api_client.select_header_content_type(
                                              ['application/json']))
        if _content_types_list:
            _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['Authorization']  # noqa: E501

        _response_types_map = {
            '200': "ResultDTOCharacterDescDTO",
        }

        return self.api_client.call_api(
            '/{0}/api/character/auto/desc'.format(self.api_client.api_version()), 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))
