# coding: utf-8

"""
    蓝鲸用户管理 API

    蓝鲸用户管理后台服务 API  # noqa: E501

    OpenAPI spec version: v2
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from bkuser_sdk.api_client import ApiClient


class SettingsApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def v2_settings_create(self, body, **kwargs):  # noqa: E501
        """v2_settings_create  # 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.v2_settings_create(body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SettingCreate body: (required)
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.v2_settings_create_with_http_info(body, **kwargs)  # noqa: E501
        else:
            (data) = self.v2_settings_create_with_http_info(body, **kwargs)  # noqa: E501
            return data

    def v2_settings_create_with_http_info(self, body, **kwargs):  # noqa: E501
        """v2_settings_create  # 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.v2_settings_create_with_http_info(body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SettingCreate body: (required)
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method v2_settings_create" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `v2_settings_create`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v2/settings/', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Setting',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def v2_settings_delete(self, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_delete  # 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.v2_settings_delete(lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str lookup_value: (required)
        :param str fields: 指定对象返回字段，支持多选，以逗号分隔，例如: username,status,id
        :param str lookup_field: 指定查询字段，内容为 lookup_value 所属字段, 例如: username
        :param bool include_disabled: 是否包含已软删除的数据
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.v2_settings_delete_with_http_info(lookup_value, **kwargs)  # noqa: E501
        else:
            (data) = self.v2_settings_delete_with_http_info(lookup_value, **kwargs)  # noqa: E501
            return data

    def v2_settings_delete_with_http_info(self, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_delete  # 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.v2_settings_delete_with_http_info(lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str lookup_value: (required)
        :param str fields: 指定对象返回字段，支持多选，以逗号分隔，例如: username,status,id
        :param str lookup_field: 指定查询字段，内容为 lookup_value 所属字段, 例如: username
        :param bool include_disabled: 是否包含已软删除的数据
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['lookup_value', 'fields', 'lookup_field', 'include_disabled']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method v2_settings_delete" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'lookup_value' is set
        if ('lookup_value' not in params or
                params['lookup_value'] is None):
            raise ValueError("Missing the required parameter `lookup_value` when calling `v2_settings_delete`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'lookup_value' in params:
            path_params['lookup_value'] = params['lookup_value']  # noqa: E501

        query_params = []
        if 'fields' in params:
            query_params.append(('fields', params['fields']))  # noqa: E501
        if 'lookup_field' in params:
            query_params.append(('lookup_field', params['lookup_field']))  # noqa: E501
        if 'include_disabled' in params:
            query_params.append(('include_disabled', params['include_disabled']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v2/settings/{lookup_value}/', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def v2_settings_list(self, category_id, **kwargs):  # noqa: E501
        """v2_settings_list  # 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.v2_settings_list(category_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int category_id: (required)
        :param str key:
        :param str namespace:
        :param str region:
        :param str domain:
        :return: list[Setting]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.v2_settings_list_with_http_info(category_id, **kwargs)  # noqa: E501
        else:
            (data) = self.v2_settings_list_with_http_info(category_id, **kwargs)  # noqa: E501
            return data

    def v2_settings_list_with_http_info(self, category_id, **kwargs):  # noqa: E501
        """v2_settings_list  # 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.v2_settings_list_with_http_info(category_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int category_id: (required)
        :param str key:
        :param str namespace:
        :param str region:
        :param str domain:
        :return: list[Setting]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['category_id', 'key', 'namespace', 'region', 'domain']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method v2_settings_list" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'category_id' is set
        if ('category_id' not in params or
                params['category_id'] is None):
            raise ValueError("Missing the required parameter `category_id` when calling `v2_settings_list`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'key' in params:
            query_params.append(('key', params['key']))  # noqa: E501
        if 'namespace' in params:
            query_params.append(('namespace', params['namespace']))  # noqa: E501
        if 'region' in params:
            query_params.append(('region', params['region']))  # noqa: E501
        if 'category_id' in params:
            query_params.append(('category_id', params['category_id']))  # noqa: E501
        if 'domain' in params:
            query_params.append(('domain', params['domain']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v2/settings/', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[Setting]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def v2_settings_partial_update(self, body, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_partial_update  # 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.v2_settings_partial_update(body, lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SettingUpdate body: (required)
        :param str lookup_value: (required)
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.v2_settings_partial_update_with_http_info(body, lookup_value, **kwargs)  # noqa: E501
        else:
            (data) = self.v2_settings_partial_update_with_http_info(body, lookup_value, **kwargs)  # noqa: E501
            return data

    def v2_settings_partial_update_with_http_info(self, body, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_partial_update  # 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.v2_settings_partial_update_with_http_info(body, lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SettingUpdate body: (required)
        :param str lookup_value: (required)
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'lookup_value']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method v2_settings_partial_update" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `v2_settings_partial_update`")  # noqa: E501
        # verify the required parameter 'lookup_value' is set
        if ('lookup_value' not in params or
                params['lookup_value'] is None):
            raise ValueError("Missing the required parameter `lookup_value` when calling `v2_settings_partial_update`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'lookup_value' in params:
            path_params['lookup_value'] = params['lookup_value']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v2/settings/{lookup_value}/', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Setting',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def v2_settings_read(self, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_read  # 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.v2_settings_read(lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str lookup_value: (required)
        :param str fields: 指定对象返回字段，支持多选，以逗号分隔，例如: username,status,id
        :param str lookup_field: 指定查询字段，内容为 lookup_value 所属字段, 例如: username
        :param bool include_disabled: 是否包含已软删除的数据
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.v2_settings_read_with_http_info(lookup_value, **kwargs)  # noqa: E501
        else:
            (data) = self.v2_settings_read_with_http_info(lookup_value, **kwargs)  # noqa: E501
            return data

    def v2_settings_read_with_http_info(self, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_read  # 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.v2_settings_read_with_http_info(lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str lookup_value: (required)
        :param str fields: 指定对象返回字段，支持多选，以逗号分隔，例如: username,status,id
        :param str lookup_field: 指定查询字段，内容为 lookup_value 所属字段, 例如: username
        :param bool include_disabled: 是否包含已软删除的数据
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['lookup_value', 'fields', 'lookup_field', 'include_disabled']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method v2_settings_read" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'lookup_value' is set
        if ('lookup_value' not in params or
                params['lookup_value'] is None):
            raise ValueError("Missing the required parameter `lookup_value` when calling `v2_settings_read`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'lookup_value' in params:
            path_params['lookup_value'] = params['lookup_value']  # noqa: E501

        query_params = []
        if 'fields' in params:
            query_params.append(('fields', params['fields']))  # noqa: E501
        if 'lookup_field' in params:
            query_params.append(('lookup_field', params['lookup_field']))  # noqa: E501
        if 'include_disabled' in params:
            query_params.append(('include_disabled', params['include_disabled']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v2/settings/{lookup_value}/', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Setting',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def v2_settings_update(self, body, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_update  # 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.v2_settings_update(body, lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SettingUpdate body: (required)
        :param str lookup_value: (required)
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.v2_settings_update_with_http_info(body, lookup_value, **kwargs)  # noqa: E501
        else:
            (data) = self.v2_settings_update_with_http_info(body, lookup_value, **kwargs)  # noqa: E501
            return data

    def v2_settings_update_with_http_info(self, body, lookup_value, **kwargs):  # noqa: E501
        """v2_settings_update  # 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.v2_settings_update_with_http_info(body, lookup_value, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SettingUpdate body: (required)
        :param str lookup_value: (required)
        :return: Setting
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body', 'lookup_value']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method v2_settings_update" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `v2_settings_update`")  # noqa: E501
        # verify the required parameter 'lookup_value' is set
        if ('lookup_value' not in params or
                params['lookup_value'] is None):
            raise ValueError("Missing the required parameter `lookup_value` when calling `v2_settings_update`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'lookup_value' in params:
            path_params['lookup_value'] = params['lookup_value']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v2/settings/{lookup_value}/', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Setting',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
