# coding: utf-8

"""
    EVE Swagger Interface

    An OpenAPI for EVE Online  # noqa: E501

    OpenAPI spec version: 0.8.0
    
    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 swagger_client.api_client import ApiClient


class MailApi(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 delete_characters_character_id_mail_labels_label_id(self, character_id, label_id, **kwargs):  # noqa: E501
        """Delete a mail label  # noqa: E501

        Delete a mail label  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.delete_characters_character_id_mail_labels_label_id(character_id, label_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param int label_id: An EVE label id (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.delete_characters_character_id_mail_labels_label_id_with_http_info(character_id, label_id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_characters_character_id_mail_labels_label_id_with_http_info(character_id, label_id, **kwargs)  # noqa: E501
            return data

    def delete_characters_character_id_mail_labels_label_id_with_http_info(self, character_id, label_id, **kwargs):  # noqa: E501
        """Delete a mail label  # noqa: E501

        Delete a mail label  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.delete_characters_character_id_mail_labels_label_id_with_http_info(character_id, label_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param int label_id: An EVE label id (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'label_id', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 delete_characters_character_id_mail_labels_label_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `delete_characters_character_id_mail_labels_label_id`")  # noqa: E501
        # verify the required parameter 'label_id' is set
        if ('label_id' not in params or
                params['label_id'] is None):
            raise ValueError("Missing the required parameter `label_id` when calling `delete_characters_character_id_mail_labels_label_id`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `delete_characters_character_id_mail_labels_label_id`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        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 = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v1/characters/{character_id}/mail/labels/{label_id}/', '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=params.get('async'),
            _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 delete_characters_character_id_mail_mail_id(self, character_id, mail_id, **kwargs):  # noqa: E501
        """Delete a mail  # noqa: E501

        Delete a mail  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.delete_characters_character_id_mail_mail_id(character_id, mail_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param int mail_id: An EVE mail ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.delete_characters_character_id_mail_mail_id_with_http_info(character_id, mail_id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_characters_character_id_mail_mail_id_with_http_info(character_id, mail_id, **kwargs)  # noqa: E501
            return data

    def delete_characters_character_id_mail_mail_id_with_http_info(self, character_id, mail_id, **kwargs):  # noqa: E501
        """Delete a mail  # noqa: E501

        Delete a mail  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.delete_characters_character_id_mail_mail_id_with_http_info(character_id, mail_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param int mail_id: An EVE mail ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'mail_id', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 delete_characters_character_id_mail_mail_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `delete_characters_character_id_mail_mail_id`")  # noqa: E501
        # verify the required parameter 'mail_id' is set
        if ('mail_id' not in params or
                params['mail_id'] is None):
            raise ValueError("Missing the required parameter `mail_id` when calling `delete_characters_character_id_mail_mail_id`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `delete_characters_character_id_mail_mail_id`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        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 = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v1/characters/{character_id}/mail/{mail_id}/', '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=params.get('async'),
            _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 get_characters_character_id_mail(self, character_id, **kwargs):  # noqa: E501
        """Return mail headers  # noqa: E501

        Return the 50 most recent mail headers belonging to the character that match the query criteria. Queries can be filtered by label, and last_mail_id can be used to paginate backwards.  ---  This route is cached for up to 30 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail(character_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param str datasource: The server name you would like data from
        :param list[int] labels: Fetch only mails that match one or more of the given labels
        :param int last_mail_id: List only mail with an ID lower than the given ID, if present
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: list[GetCharactersCharacterIdMail200Ok]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_characters_character_id_mail_with_http_info(character_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_characters_character_id_mail_with_http_info(character_id, **kwargs)  # noqa: E501
            return data

    def get_characters_character_id_mail_with_http_info(self, character_id, **kwargs):  # noqa: E501
        """Return mail headers  # noqa: E501

        Return the 50 most recent mail headers belonging to the character that match the query criteria. Queries can be filtered by label, and last_mail_id can be used to paginate backwards.  ---  This route is cached for up to 30 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail_with_http_info(character_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param str datasource: The server name you would like data from
        :param list[int] labels: Fetch only mails that match one or more of the given labels
        :param int last_mail_id: List only mail with an ID lower than the given ID, if present
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: list[GetCharactersCharacterIdMail200Ok]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'datasource', 'labels', 'last_mail_id', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 get_characters_character_id_mail" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `get_characters_character_id_mail`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `get_characters_character_id_mail`, must be a value greater than or equal to `1`")  # noqa: E501
        if ('labels' in params and
                len(params['labels']) > 25):
            raise ValueError("Invalid value for parameter `labels` when calling `get_characters_character_id_mail`, number of items must be less than or equal to `25`")  # noqa: E501
        if ('labels' in params and
                len(params['labels']) < 1):
            raise ValueError("Invalid value for parameter `labels` when calling `get_characters_character_id_mail`, number of items must be greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'labels' in params:
            query_params.append(('labels', params['labels']))  # noqa: E501
            collection_formats['labels'] = 'csv'  # noqa: E501
        if 'last_mail_id' in params:
            query_params.append(('last_mail_id', params['last_mail_id']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        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 = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v1/characters/{character_id}/mail/', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[GetCharactersCharacterIdMail200Ok]',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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 get_characters_character_id_mail_labels(self, character_id, **kwargs):  # noqa: E501
        """Get mail labels and unread counts  # noqa: E501

        Return a list of the users mail labels, unread counts for each label and a total unread count.  ---  This route is cached for up to 30 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail_labels(character_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: GetCharactersCharacterIdMailLabelsOk
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_characters_character_id_mail_labels_with_http_info(character_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_characters_character_id_mail_labels_with_http_info(character_id, **kwargs)  # noqa: E501
            return data

    def get_characters_character_id_mail_labels_with_http_info(self, character_id, **kwargs):  # noqa: E501
        """Get mail labels and unread counts  # noqa: E501

        Return a list of the users mail labels, unread counts for each label and a total unread count.  ---  This route is cached for up to 30 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail_labels_with_http_info(character_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: GetCharactersCharacterIdMailLabelsOk
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 get_characters_character_id_mail_labels" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `get_characters_character_id_mail_labels`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `get_characters_character_id_mail_labels`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        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 = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v3/characters/{character_id}/mail/labels/', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='GetCharactersCharacterIdMailLabelsOk',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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 get_characters_character_id_mail_lists(self, character_id, **kwargs):  # noqa: E501
        """Return mailing list subscriptions  # noqa: E501

        Return all mailing lists that the character is subscribed to  ---  This route is cached for up to 120 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail_lists(character_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: list[GetCharactersCharacterIdMailLists200Ok]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_characters_character_id_mail_lists_with_http_info(character_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_characters_character_id_mail_lists_with_http_info(character_id, **kwargs)  # noqa: E501
            return data

    def get_characters_character_id_mail_lists_with_http_info(self, character_id, **kwargs):  # noqa: E501
        """Return mailing list subscriptions  # noqa: E501

        Return all mailing lists that the character is subscribed to  ---  This route is cached for up to 120 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail_lists_with_http_info(character_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: list[GetCharactersCharacterIdMailLists200Ok]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 get_characters_character_id_mail_lists" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `get_characters_character_id_mail_lists`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `get_characters_character_id_mail_lists`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        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 = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v1/characters/{character_id}/mail/lists/', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[GetCharactersCharacterIdMailLists200Ok]',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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 get_characters_character_id_mail_mail_id(self, character_id, mail_id, **kwargs):  # noqa: E501
        """Return a mail  # noqa: E501

        Return the contents of an EVE mail  ---  This route is cached for up to 30 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail_mail_id(character_id, mail_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param int mail_id: An EVE mail ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: GetCharactersCharacterIdMailMailIdOk
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_characters_character_id_mail_mail_id_with_http_info(character_id, mail_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_characters_character_id_mail_mail_id_with_http_info(character_id, mail_id, **kwargs)  # noqa: E501
            return data

    def get_characters_character_id_mail_mail_id_with_http_info(self, character_id, mail_id, **kwargs):  # noqa: E501
        """Return a mail  # noqa: E501

        Return the contents of an EVE mail  ---  This route is cached for up to 30 seconds  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_characters_character_id_mail_mail_id_with_http_info(character_id, mail_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param int mail_id: An EVE mail ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: GetCharactersCharacterIdMailMailIdOk
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'mail_id', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 get_characters_character_id_mail_mail_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `get_characters_character_id_mail_mail_id`")  # noqa: E501
        # verify the required parameter 'mail_id' is set
        if ('mail_id' not in params or
                params['mail_id'] is None):
            raise ValueError("Missing the required parameter `mail_id` when calling `get_characters_character_id_mail_mail_id`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `get_characters_character_id_mail_mail_id`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        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 = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v1/characters/{character_id}/mail/{mail_id}/', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='GetCharactersCharacterIdMailMailIdOk',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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 post_characters_character_id_mail(self, character_id, mail, **kwargs):  # noqa: E501
        """Send a new mail  # noqa: E501

        Create and send a new mail  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_characters_character_id_mail(character_id, mail, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param PostCharactersCharacterIdMailMail mail: The mail to send (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: int
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.post_characters_character_id_mail_with_http_info(character_id, mail, **kwargs)  # noqa: E501
        else:
            (data) = self.post_characters_character_id_mail_with_http_info(character_id, mail, **kwargs)  # noqa: E501
            return data

    def post_characters_character_id_mail_with_http_info(self, character_id, mail, **kwargs):  # noqa: E501
        """Send a new mail  # noqa: E501

        Create and send a new mail  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_characters_character_id_mail_with_http_info(character_id, mail, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param PostCharactersCharacterIdMailMail mail: The mail to send (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: int
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'mail', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 post_characters_character_id_mail" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `post_characters_character_id_mail`")  # noqa: E501
        # verify the required parameter 'mail' is set
        if ('mail' not in params or
                params['mail'] is None):
            raise ValueError("Missing the required parameter `mail` when calling `post_characters_character_id_mail`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `post_characters_character_id_mail`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v1/characters/{character_id}/mail/', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='int',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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 post_characters_character_id_mail_labels(self, character_id, label, **kwargs):  # noqa: E501
        """Create a mail label  # noqa: E501

        Create a mail label  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_characters_character_id_mail_labels(character_id, label, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param PostCharactersCharacterIdMailLabelsLabel label: Label to create (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: int
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.post_characters_character_id_mail_labels_with_http_info(character_id, label, **kwargs)  # noqa: E501
        else:
            (data) = self.post_characters_character_id_mail_labels_with_http_info(character_id, label, **kwargs)  # noqa: E501
            return data

    def post_characters_character_id_mail_labels_with_http_info(self, character_id, label, **kwargs):  # noqa: E501
        """Create a mail label  # noqa: E501

        Create a mail label  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_characters_character_id_mail_labels_with_http_info(character_id, label, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param PostCharactersCharacterIdMailLabelsLabel label: Label to create (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: int
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'label', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 post_characters_character_id_mail_labels" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `post_characters_character_id_mail_labels`")  # noqa: E501
        # verify the required parameter 'label' is set
        if ('label' not in params or
                params['label'] is None):
            raise ValueError("Missing the required parameter `label` when calling `post_characters_character_id_mail_labels`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `post_characters_character_id_mail_labels`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v2/characters/{character_id}/mail/labels/', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='int',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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 put_characters_character_id_mail_mail_id(self, character_id, contents, mail_id, **kwargs):  # noqa: E501
        """Update metadata about a mail  # noqa: E501

        Update metadata about a mail  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.put_characters_character_id_mail_mail_id(character_id, contents, mail_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param PutCharactersCharacterIdMailMailIdContents contents: Data used to update the mail (required)
        :param int mail_id: An EVE mail ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.put_characters_character_id_mail_mail_id_with_http_info(character_id, contents, mail_id, **kwargs)  # noqa: E501
        else:
            (data) = self.put_characters_character_id_mail_mail_id_with_http_info(character_id, contents, mail_id, **kwargs)  # noqa: E501
            return data

    def put_characters_character_id_mail_mail_id_with_http_info(self, character_id, contents, mail_id, **kwargs):  # noqa: E501
        """Update metadata about a mail  # noqa: E501

        Update metadata about a mail  ---   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.put_characters_character_id_mail_mail_id_with_http_info(character_id, contents, mail_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param int character_id: An EVE character ID (required)
        :param PutCharactersCharacterIdMailMailIdContents contents: Data used to update the mail (required)
        :param int mail_id: An EVE mail ID (required)
        :param str datasource: The server name you would like data from
        :param str token: Access token to use if unable to set a header
        :param str user_agent: Client identifier, takes precedence over headers
        :param str x_user_agent: Client identifier, takes precedence over User-Agent
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['character_id', 'contents', 'mail_id', 'datasource', 'token', 'user_agent', 'x_user_agent']  # noqa: E501
        all_params.append('async')
        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 put_characters_character_id_mail_mail_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'character_id' is set
        if ('character_id' not in params or
                params['character_id'] is None):
            raise ValueError("Missing the required parameter `character_id` when calling `put_characters_character_id_mail_mail_id`")  # noqa: E501
        # verify the required parameter 'contents' is set
        if ('contents' not in params or
                params['contents'] is None):
            raise ValueError("Missing the required parameter `contents` when calling `put_characters_character_id_mail_mail_id`")  # noqa: E501
        # verify the required parameter 'mail_id' is set
        if ('mail_id' not in params or
                params['mail_id'] is None):
            raise ValueError("Missing the required parameter `mail_id` when calling `put_characters_character_id_mail_mail_id`")  # noqa: E501

        if 'character_id' in params and params['character_id'] < 1:  # noqa: E501
            raise ValueError("Invalid value for parameter `character_id` when calling `put_characters_character_id_mail_mail_id`, must be a value greater than or equal to `1`")  # noqa: E501
        collection_formats = {}

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

        query_params = []
        if 'datasource' in params:
            query_params.append(('datasource', params['datasource']))  # noqa: E501
        if 'token' in params:
            query_params.append(('token', params['token']))  # noqa: E501
        if 'user_agent' in params:
            query_params.append(('user_agent', params['user_agent']))  # noqa: E501

        header_params = {}
        if 'x_user_agent' in params:
            header_params['X-User-Agent'] = params['x_user_agent']  # noqa: E501

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['evesso']  # noqa: E501

        return self.api_client.call_api(
            '/v1/characters/{character_id}/mail/{mail_id}/', 'PUT',
            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=params.get('async'),
            _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)
