# coding: utf-8

"""
    

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

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


class LemmatronApi(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 inflections_source_lang_word_id_filters_get(self, source_lang, word_id, filters, app_id, app_key, **kwargs):  # noqa: E501
        """Apply optional filters to Lemmatron response  # noqa: E501

         Retrieve available [lemmas](documentation/glossary?term=lemma) for a given [inflected](documentation/glossary?term=inflection) wordform. Filter results by categories.      <div id=\"lemmatron_filters\"></div>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.inflections_source_lang_word_id_filters_get(source_lang, word_id, filters, app_id, app_key, async=True)
        >>> result = thread.get()

        :param async bool
        :param str source_lang: IANA language code (required)
        :param str word_id: The input word (required)
        :param list[str] filters: Separate filtering conditions using a semicolon. Conditions take values grammaticalFeatures and/or lexicalCategory and are case-sensitive. To list multiple values in single condition divide them with comma. (required)
        :param str app_id: App ID Authentication Parameter (required)
        :param str app_key: App Key Authentication Parameter (required)
        :return: Lemmatron
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.inflections_source_lang_word_id_filters_get_with_http_info(source_lang, word_id, filters, app_id, app_key, **kwargs)  # noqa: E501
        else:
            (data) = self.inflections_source_lang_word_id_filters_get_with_http_info(source_lang, word_id, filters, app_id, app_key, **kwargs)  # noqa: E501
            return data

    def inflections_source_lang_word_id_filters_get_with_http_info(self, source_lang, word_id, filters, app_id, app_key, **kwargs):  # noqa: E501
        """Apply optional filters to Lemmatron response  # noqa: E501

         Retrieve available [lemmas](documentation/glossary?term=lemma) for a given [inflected](documentation/glossary?term=inflection) wordform. Filter results by categories.      <div id=\"lemmatron_filters\"></div>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.inflections_source_lang_word_id_filters_get_with_http_info(source_lang, word_id, filters, app_id, app_key, async=True)
        >>> result = thread.get()

        :param async bool
        :param str source_lang: IANA language code (required)
        :param str word_id: The input word (required)
        :param list[str] filters: Separate filtering conditions using a semicolon. Conditions take values grammaticalFeatures and/or lexicalCategory and are case-sensitive. To list multiple values in single condition divide them with comma. (required)
        :param str app_id: App ID Authentication Parameter (required)
        :param str app_key: App Key Authentication Parameter (required)
        :return: Lemmatron
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['source_lang', 'word_id', 'filters', 'app_id', 'app_key']  # 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 inflections_source_lang_word_id_filters_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'source_lang' is set
        if ('source_lang' not in params or
                params['source_lang'] is None):
            raise ValueError("Missing the required parameter `source_lang` when calling `inflections_source_lang_word_id_filters_get`")  # noqa: E501
        # verify the required parameter 'word_id' is set
        if ('word_id' not in params or
                params['word_id'] is None):
            raise ValueError("Missing the required parameter `word_id` when calling `inflections_source_lang_word_id_filters_get`")  # noqa: E501
        # verify the required parameter 'filters' is set
        if ('filters' not in params or
                params['filters'] is None):
            raise ValueError("Missing the required parameter `filters` when calling `inflections_source_lang_word_id_filters_get`")  # noqa: E501
        # verify the required parameter 'app_id' is set
        if ('app_id' not in params or
                params['app_id'] is None):
            raise ValueError("Missing the required parameter `app_id` when calling `inflections_source_lang_word_id_filters_get`")  # noqa: E501
        # verify the required parameter 'app_key' is set
        if ('app_key' not in params or
                params['app_key'] is None):
            raise ValueError("Missing the required parameter `app_key` when calling `inflections_source_lang_word_id_filters_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'source_lang' in params:
            path_params['source_lang'] = params['source_lang']  # noqa: E501
        if 'word_id' in params:
            path_params['word_id'] = params['word_id']  # noqa: E501
        if 'filters' in params:
            path_params['filters'] = params['filters']  # noqa: E501
            collection_formats['filters'] = 'csv'  # noqa: E501

        query_params = []

        header_params = {}
        if 'app_id' in params:
            header_params['app_id'] = params['app_id']  # noqa: E501
        if 'app_key' in params:
            header_params['app_key'] = params['app_key']  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/inflections/{source_lang}/{word_id}/{filters}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Lemmatron',  # 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 inflections_source_lang_word_id_get(self, source_lang, word_id, app_id, app_key, **kwargs):  # noqa: E501
        """Check a word exists in the dictionary and retrieve its root form  # noqa: E501

         Use this to check if a word exists in the dictionary, or what 'root' form it links to (e.g., swimming > swim). The response tells you the possible [lemmas](documentation/glossary?term=lemma) for a given [inflected](documentation/glossary?term=inflection) word. This can then be combined with other endpoints to retrieve more information.    <div id=\"lemmatron\"></div>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.inflections_source_lang_word_id_get(source_lang, word_id, app_id, app_key, async=True)
        >>> result = thread.get()

        :param async bool
        :param str source_lang: IANA language code (required)
        :param str word_id: The input word (required)
        :param str app_id: App ID Authentication Parameter (required)
        :param str app_key: App Key Authentication Parameter (required)
        :return: Lemmatron
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.inflections_source_lang_word_id_get_with_http_info(source_lang, word_id, app_id, app_key, **kwargs)  # noqa: E501
        else:
            (data) = self.inflections_source_lang_word_id_get_with_http_info(source_lang, word_id, app_id, app_key, **kwargs)  # noqa: E501
            return data

    def inflections_source_lang_word_id_get_with_http_info(self, source_lang, word_id, app_id, app_key, **kwargs):  # noqa: E501
        """Check a word exists in the dictionary and retrieve its root form  # noqa: E501

         Use this to check if a word exists in the dictionary, or what 'root' form it links to (e.g., swimming > swim). The response tells you the possible [lemmas](documentation/glossary?term=lemma) for a given [inflected](documentation/glossary?term=inflection) word. This can then be combined with other endpoints to retrieve more information.    <div id=\"lemmatron\"></div>   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.inflections_source_lang_word_id_get_with_http_info(source_lang, word_id, app_id, app_key, async=True)
        >>> result = thread.get()

        :param async bool
        :param str source_lang: IANA language code (required)
        :param str word_id: The input word (required)
        :param str app_id: App ID Authentication Parameter (required)
        :param str app_key: App Key Authentication Parameter (required)
        :return: Lemmatron
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['source_lang', 'word_id', 'app_id', 'app_key']  # 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 inflections_source_lang_word_id_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'source_lang' is set
        if ('source_lang' not in params or
                params['source_lang'] is None):
            raise ValueError("Missing the required parameter `source_lang` when calling `inflections_source_lang_word_id_get`")  # noqa: E501
        # verify the required parameter 'word_id' is set
        if ('word_id' not in params or
                params['word_id'] is None):
            raise ValueError("Missing the required parameter `word_id` when calling `inflections_source_lang_word_id_get`")  # noqa: E501
        # verify the required parameter 'app_id' is set
        if ('app_id' not in params or
                params['app_id'] is None):
            raise ValueError("Missing the required parameter `app_id` when calling `inflections_source_lang_word_id_get`")  # noqa: E501
        # verify the required parameter 'app_key' is set
        if ('app_key' not in params or
                params['app_key'] is None):
            raise ValueError("Missing the required parameter `app_key` when calling `inflections_source_lang_word_id_get`")  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'app_id' in params:
            header_params['app_id'] = params['app_id']  # noqa: E501
        if 'app_key' in params:
            header_params['app_key'] = params['app_key']  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/inflections/{source_lang}/{word_id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Lemmatron',  # 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)
