# coding: utf-8

"""
    herd

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

    OpenAPI spec version: 0.178.0-SNAPSHOT
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from herdsdk.api_client import ApiClient


class TagTypeApi(object):
    """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):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def tag_type_create_tag_type(self, tag_type_create_request, **kwargs):  # noqa: E501
        """createTagType  # noqa: E501

        Creates a new tag type.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_create_tag_type(tag_type_create_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param TagTypeCreateRequest tag_type_create_request: the information needed to create the tag type (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.tag_type_create_tag_type_with_http_info(tag_type_create_request, **kwargs)  # noqa: E501
        else:
            (data) = self.tag_type_create_tag_type_with_http_info(tag_type_create_request, **kwargs)  # noqa: E501
            return data

    def tag_type_create_tag_type_with_http_info(self, tag_type_create_request, **kwargs):  # noqa: E501
        """createTagType  # noqa: E501

        Creates a new tag type.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_create_tag_type_with_http_info(tag_type_create_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param TagTypeCreateRequest tag_type_create_request: the information needed to create the tag type (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['basicAuth', 'oauthAuth']  # noqa: E501

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

    def tag_type_delete_tag_type(self, tag_type_code, **kwargs):  # noqa: E501
        """deleteTagType  # noqa: E501

        Deletes an existing tag type by tag type code.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_delete_tag_type(tag_type_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str tag_type_code: the tag type code (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.tag_type_delete_tag_type_with_http_info(tag_type_code, **kwargs)  # noqa: E501
        else:
            (data) = self.tag_type_delete_tag_type_with_http_info(tag_type_code, **kwargs)  # noqa: E501
            return data

    def tag_type_delete_tag_type_with_http_info(self, tag_type_code, **kwargs):  # noqa: E501
        """deleteTagType  # noqa: E501

        Deletes an existing tag type by tag type code.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_delete_tag_type_with_http_info(tag_type_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str tag_type_code: the tag type code (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'tag_type_code' in local_var_params:
            path_params['tagTypeCode'] = local_var_params['tag_type_code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/tagTypes/{tagTypeCode}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TagType',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def tag_type_get_tag_type(self, tag_type_code, **kwargs):  # noqa: E501
        """getTagType  # noqa: E501

        Gets an existing tag type by tag type code.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_get_tag_type(tag_type_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str tag_type_code: the tag type code (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.tag_type_get_tag_type_with_http_info(tag_type_code, **kwargs)  # noqa: E501
        else:
            (data) = self.tag_type_get_tag_type_with_http_info(tag_type_code, **kwargs)  # noqa: E501
            return data

    def tag_type_get_tag_type_with_http_info(self, tag_type_code, **kwargs):  # noqa: E501
        """getTagType  # noqa: E501

        Gets an existing tag type by tag type code.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_get_tag_type_with_http_info(tag_type_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str tag_type_code: the tag type code (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'tag_type_code' in local_var_params:
            path_params['tagTypeCode'] = local_var_params['tag_type_code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/tagTypes/{tagTypeCode}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TagType',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def tag_type_get_tag_types(self, **kwargs):  # noqa: E501
        """getTagTypes  # noqa: E501

        Gets a list of tag type keys for all tag types defined in the system.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_get_tag_types(async_req=True)
        >>> result = thread.get()

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

    def tag_type_get_tag_types_with_http_info(self, **kwargs):  # noqa: E501
        """getTagTypes  # noqa: E501

        Gets a list of tag type keys for all tag types defined in the system.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_get_tag_types_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: TagTypeKeys
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method tag_type_get_tag_types" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/tagTypes', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TagTypeKeys',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def tag_type_search_tag_types(self, tag_type_search_request, **kwargs):  # noqa: E501
        """searchTagTypes  # noqa: E501

        Retrieves all tag types existing in the system. For each tag type entity, the endpoint returns tag type key by default along with any other top-level elements as specified by the \"fields\" query string parameter. The list of tag types returned by the endpoint is sorted alphabetically by tag type's order value ascending.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_search_tag_types(tag_type_search_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param TagTypeSearchRequest tag_type_search_request: the tag type search request. The request does not take any search keys or filters (required)
        :param str fields: the field options for the tag type search response. The valid field options are: displayName, tagTypeOrder and description
        :return: TagTypeSearchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.tag_type_search_tag_types_with_http_info(tag_type_search_request, **kwargs)  # noqa: E501
        else:
            (data) = self.tag_type_search_tag_types_with_http_info(tag_type_search_request, **kwargs)  # noqa: E501
            return data

    def tag_type_search_tag_types_with_http_info(self, tag_type_search_request, **kwargs):  # noqa: E501
        """searchTagTypes  # noqa: E501

        Retrieves all tag types existing in the system. For each tag type entity, the endpoint returns tag type key by default along with any other top-level elements as specified by the \"fields\" query string parameter. The list of tag types returned by the endpoint is sorted alphabetically by tag type's order value ascending.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_search_tag_types_with_http_info(tag_type_search_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param TagTypeSearchRequest tag_type_search_request: the tag type search request. The request does not take any search keys or filters (required)
        :param str fields: the field options for the tag type search response. The valid field options are: displayName, tagTypeOrder and description
        :return: TagTypeSearchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}

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

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/tagTypes/search', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TagTypeSearchResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def tag_type_update_tag_type(self, tag_type_code, tag_type_update_request, **kwargs):  # noqa: E501
        """updateTagType  # noqa: E501

        Updates an existing tag type.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_update_tag_type(tag_type_code, tag_type_update_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str tag_type_code: the tag type code (required)
        :param TagTypeUpdateRequest tag_type_update_request: the information needed to update the tag type (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.tag_type_update_tag_type_with_http_info(tag_type_code, tag_type_update_request, **kwargs)  # noqa: E501
        else:
            (data) = self.tag_type_update_tag_type_with_http_info(tag_type_code, tag_type_update_request, **kwargs)  # noqa: E501
            return data

    def tag_type_update_tag_type_with_http_info(self, tag_type_code, tag_type_update_request, **kwargs):  # noqa: E501
        """updateTagType  # noqa: E501

        Updates an existing tag type.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.tag_type_update_tag_type_with_http_info(tag_type_code, tag_type_update_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str tag_type_code: the tag type code (required)
        :param TagTypeUpdateRequest tag_type_update_request: the information needed to update the tag type (required)
        :return: TagType
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'tag_type_code' in local_var_params:
            path_params['tagTypeCode'] = local_var_params['tag_type_code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['basicAuth', 'oauthAuth']  # noqa: E501

        return self.api_client.call_api(
            '/tagTypes/{tagTypeCode}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TagType',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
