# coding: utf-8

"""
    Translator Knowledge Beacon Aggregator API

    This is the Translator Knowledge Beacon Aggregator web service application programming interface (API) that provides integrated access to a pool of knowledge sources publishing concepts and relations through the Translator Knowledge Beacon API. This API is similar to that of the latter mentioned API with the addition of some extra informative endpoints plus session identifier and beacon indices. These latter identifiers are locally assigned numeric indices provided to track the use of specific registered beacons within the aggregator API itself.   # noqa: E501

    OpenAPI spec version: 1.1.3
    Contact: richard@starinformatics.com
    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 kba.api_client import ApiClient


class ConceptsApi(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 get_cliques(self, query_id, **kwargs):  # noqa: E501
        """get_cliques  # noqa: E501

        Retrieves a list of concept cliques based on  'data ready' from a previously /cliques posted query parameter submission   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_cliques(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: the query identifier of a concepts query previously posted by the /cliques endpoint (required)
        :return: ServerCliquesQueryResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_cliques_with_http_info(query_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_cliques_with_http_info(query_id, **kwargs)  # noqa: E501
            return data

    def get_cliques_with_http_info(self, query_id, **kwargs):  # noqa: E501
        """get_cliques  # noqa: E501

        Retrieves a list of concept cliques based on  'data ready' from a previously /cliques posted query parameter submission   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_cliques_with_http_info(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: the query identifier of a concepts query previously posted by the /cliques endpoint (required)
        :return: ServerCliquesQueryResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'query_id' in params:
            path_params['queryId'] = params['query_id']  # 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'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/cliques/data/{queryId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerCliquesQueryResult',  # 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_cliques_query_status(self, query_id, **kwargs):  # noqa: E501
        """get_cliques_query_status  # noqa: E501

        Retrieves the status of a given query about the cliques in the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_cliques_query_status(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: an active query identifier as returned by a POST of clique query parameters. (required)
        :return: ServerCliquesQueryStatus
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_cliques_query_status_with_http_info(query_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_cliques_query_status_with_http_info(query_id, **kwargs)  # noqa: E501
            return data

    def get_cliques_query_status_with_http_info(self, query_id, **kwargs):  # noqa: E501
        """get_cliques_query_status  # noqa: E501

        Retrieves the status of a given query about the cliques in the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_cliques_query_status_with_http_info(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: an active query identifier as returned by a POST of clique query parameters. (required)
        :return: ServerCliquesQueryStatus
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'query_id' in params:
            path_params['queryId'] = params['query_id']  # 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'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/cliques/status/{queryId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerCliquesQueryStatus',  # 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_concept_details(self, clique_id, **kwargs):  # noqa: E501
        """get_concept_details  # noqa: E501

        Retrieves details for a specified clique of equivalent concepts in the system,  as specified by a (url-encoded) CURIE identifier of a clique known to the aggregator   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_concept_details(clique_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str clique_id: a [CURIE-encoded](https://www.w3.org/TR/curie/) identifier, as returned  by any other endpoint of the beacon aggregator API, of an exactly matching  concept clique of interest. (required)
        :param list[int] beacons: set of aggregator indices of beacons to be used as knowledge sources for the query 
        :return: ServerConceptWithDetails
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_concept_details_with_http_info(clique_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_concept_details_with_http_info(clique_id, **kwargs)  # noqa: E501
            return data

    def get_concept_details_with_http_info(self, clique_id, **kwargs):  # noqa: E501
        """get_concept_details  # noqa: E501

        Retrieves details for a specified clique of equivalent concepts in the system,  as specified by a (url-encoded) CURIE identifier of a clique known to the aggregator   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_concept_details_with_http_info(clique_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str clique_id: a [CURIE-encoded](https://www.w3.org/TR/curie/) identifier, as returned  by any other endpoint of the beacon aggregator API, of an exactly matching  concept clique of interest. (required)
        :param list[int] beacons: set of aggregator indices of beacons to be used as knowledge sources for the query 
        :return: ServerConceptWithDetails
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'beacons' in params:
            query_params.append(('beacons', params['beacons']))  # noqa: E501
            collection_formats['beacons'] = 'csv'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/concepts/details/{cliqueId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConceptWithDetails',  # 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_concepts(self, query_id, **kwargs):  # noqa: E501
        """get_concepts  # noqa: E501

        Retrieves a (paged) list of basic equivalent concept clique data from beacons 'data ready' from a previously /concepts posted query parameter submission   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_concepts(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: the query identifier of a concepts query previously posted by the /concepts endpoint (required)
        :param list[int] beacons: set of aggregator indices of beacons whose data are to be retrieved 
        :param int page_number: (1-based) number of the page to be returned in a paged set of query results. Defaults to '1'. 
        :param int page_size: number of concepts per page to be returned in a paged set of query results. Defaults to '10'. 
        :return: ServerConceptsQueryResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_concepts_with_http_info(query_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_concepts_with_http_info(query_id, **kwargs)  # noqa: E501
            return data

    def get_concepts_with_http_info(self, query_id, **kwargs):  # noqa: E501
        """get_concepts  # noqa: E501

        Retrieves a (paged) list of basic equivalent concept clique data from beacons 'data ready' from a previously /concepts posted query parameter submission   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_concepts_with_http_info(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: the query identifier of a concepts query previously posted by the /concepts endpoint (required)
        :param list[int] beacons: set of aggregator indices of beacons whose data are to be retrieved 
        :param int page_number: (1-based) number of the page to be returned in a paged set of query results. Defaults to '1'. 
        :param int page_size: number of concepts per page to be returned in a paged set of query results. Defaults to '10'. 
        :return: ServerConceptsQueryResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'beacons' in params:
            query_params.append(('beacons', params['beacons']))  # noqa: E501
            collection_formats['beacons'] = 'csv'  # noqa: E501
        if 'page_number' in params:
            query_params.append(('pageNumber', params['page_number']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('pageSize', params['page_size']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/concepts/data/{queryId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConceptsQueryResult',  # 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_concepts_query_status(self, query_id, **kwargs):  # noqa: E501
        """get_concepts_query_status  # noqa: E501

        Retrieves the status of a given keyword search query about the concepts in the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_concepts_query_status(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: an active query identifier as returned by a POST of concept query parameters. (required)
        :param list[int] beacons: subset of aggregator indices of beacons whose status is being polled (if omitted, then the status of all beacons from the query are returned) 
        :return: ServerConceptsQueryStatus
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.get_concepts_query_status_with_http_info(query_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_concepts_query_status_with_http_info(query_id, **kwargs)  # noqa: E501
            return data

    def get_concepts_query_status_with_http_info(self, query_id, **kwargs):  # noqa: E501
        """get_concepts_query_status  # noqa: E501

        Retrieves the status of a given keyword search query about the concepts in the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.get_concepts_query_status_with_http_info(query_id, async=True)
        >>> result = thread.get()

        :param async bool
        :param str query_id: an active query identifier as returned by a POST of concept query parameters. (required)
        :param list[int] beacons: subset of aggregator indices of beacons whose status is being polled (if omitted, then the status of all beacons from the query are returned) 
        :return: ServerConceptsQueryStatus
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'beacons' in params:
            query_params.append(('beacons', params['beacons']))  # noqa: E501
            collection_formats['beacons'] = 'csv'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/concepts/status/{queryId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConceptsQueryStatus',  # 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_cliques_query(self, ids, **kwargs):  # noqa: E501
        """post_cliques_query  # noqa: E501

        Retrieves the beacon aggregator assigned cliques of equivalent concepts that includes the specified (url-encoded) CURIE identifiers. Note that the clique to which a given concept CURIE belongs may change over time as the aggregator progressively discovers the members of the clique. Any unmatched identifiers will be ignored (e.g. the id couldn't be found in any of the beacons)   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_cliques_query(ids, async=True)
        >>> result = thread.get()

        :param async bool
        :param list[str] ids: an array of [CURIE-encoded](https://www.w3.org/TR/curie/) identifiers of interest to be resolved to a list of concept cliques (required)
        :return: ServerCliquesQuery
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.post_cliques_query_with_http_info(ids, **kwargs)  # noqa: E501
        else:
            (data) = self.post_cliques_query_with_http_info(ids, **kwargs)  # noqa: E501
            return data

    def post_cliques_query_with_http_info(self, ids, **kwargs):  # noqa: E501
        """post_cliques_query  # noqa: E501

        Retrieves the beacon aggregator assigned cliques of equivalent concepts that includes the specified (url-encoded) CURIE identifiers. Note that the clique to which a given concept CURIE belongs may change over time as the aggregator progressively discovers the members of the clique. Any unmatched identifiers will be ignored (e.g. the id couldn't be found in any of the beacons)   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_cliques_query_with_http_info(ids, async=True)
        >>> result = thread.get()

        :param async bool
        :param list[str] ids: an array of [CURIE-encoded](https://www.w3.org/TR/curie/) identifiers of interest to be resolved to a list of concept cliques (required)
        :return: ServerCliquesQuery
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'ids' in params:
            query_params.append(('ids', params['ids']))  # noqa: E501
            collection_formats['ids'] = 'csv'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/cliques', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerCliquesQuery',  # 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_concepts_query(self, keywords, **kwargs):  # noqa: E501
        """post_concepts_query  # noqa: E501

        Posts the query parameters to retrieves a list of concepts from the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_concepts_query(keywords, async=True)
        >>> result = thread.get()

        :param async bool
        :param list[str] keywords: an array of keywords or substrings against which to match concept names and synonyms (required)
        :param list[str] categories: a subset array of concept categories (specified as codes 'gene', 'pathway', etc.) to which to constrain concepts matched by the main keyword search (see [Biolink Model](https://biolink.github.io/biolink-model) for the full list of codes) 
        :param list[int] beacons: subset of aggregator indices of beacons to be used as knowledge sources for the query (if omitted, then the all beacons are queried) 
        :return: ServerConceptsQuery
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.post_concepts_query_with_http_info(keywords, **kwargs)  # noqa: E501
        else:
            (data) = self.post_concepts_query_with_http_info(keywords, **kwargs)  # noqa: E501
            return data

    def post_concepts_query_with_http_info(self, keywords, **kwargs):  # noqa: E501
        """post_concepts_query  # noqa: E501

        Posts the query parameters to retrieves a list of concepts from the system   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.post_concepts_query_with_http_info(keywords, async=True)
        >>> result = thread.get()

        :param async bool
        :param list[str] keywords: an array of keywords or substrings against which to match concept names and synonyms (required)
        :param list[str] categories: a subset array of concept categories (specified as codes 'gene', 'pathway', etc.) to which to constrain concepts matched by the main keyword search (see [Biolink Model](https://biolink.github.io/biolink-model) for the full list of codes) 
        :param list[int] beacons: subset of aggregator indices of beacons to be used as knowledge sources for the query (if omitted, then the all beacons are queried) 
        :return: ServerConceptsQuery
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'keywords' in params:
            query_params.append(('keywords', params['keywords']))  # noqa: E501
            collection_formats['keywords'] = 'csv'  # noqa: E501
        if 'categories' in params:
            query_params.append(('categories', params['categories']))  # noqa: E501
            collection_formats['categories'] = 'csv'  # noqa: E501
        if 'beacons' in params:
            query_params.append(('beacons', params['beacons']))  # noqa: E501
            collection_formats['beacons'] = 'csv'  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/concepts', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ServerConceptsQuery',  # 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)
