# coding: utf-8

"""
    Sparks OpenAPI

    Generated documentation for the Logicdrop Sparks API and OpenAPI clients.  Logicdrop Sparks lets users build rules, analyze data, and automate documents.  Use it to make decisions faster, generate documents better, and learn from your data.  ### Documentation - [User Documentation](https://docs.logicdrop.com)  ### Modules - [Sparks Compute](https://docs.logicdrop.com/rules/introduction) - [Sparks Decision Tables](https://docs.logicdrop.com/rules/authoring-decision-tables) - [Sparks Documents](https://docs.logicdrop.com/documents/introduction)  ### Clients - [OpenAPI Clients](https://docs.logicdrop.com/development/sample-clients)  ### Security - [Authorizing API Requests](https://docs.logicdrop.com/development/authorization)   # noqa: E501

    The version of the OpenAPI document: v_VERSION_._BUILD_
    Contact: support@logicdrop.com
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from logicdrop.sparks.openapi.api_client import ApiClient
from logicdrop.sparks.openapi.exceptions import (
    ApiTypeError,
    ApiValueError
)


class QueryServicesApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

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

    def delete_queries(self, client, project, delete_artifact_request, **kwargs):  # noqa: E501
        """Delete queries  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_queries(client, project, delete_artifact_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param DeleteArtifactRequest delete_artifact_request: Remove queries by criteria (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: ArtifactResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.delete_queries_with_http_info(client, project, delete_artifact_request, **kwargs)  # noqa: E501

    def delete_queries_with_http_info(self, client, project, delete_artifact_request, **kwargs):  # noqa: E501
        """Delete queries  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_queries_with_http_info(client, project, delete_artifact_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param DeleteArtifactRequest delete_artifact_request: Remove queries by criteria (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(ArtifactResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_queries" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `delete_queries`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `delete_queries`")  # noqa: E501
        # verify the required parameter 'delete_artifact_request' is set
        if self.api_client.client_side_validation and ('delete_artifact_request' not in local_var_params or  # noqa: E501
                                                        local_var_params['delete_artifact_request'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `delete_artifact_request` when calling `delete_queries`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['api', 'jwt', 'oauth2']  # noqa: E501

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

    def delete_query(self, client, project, artifact, **kwargs):  # noqa: E501
        """Delete query  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_query(client, project, artifact, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param str artifact: Query name (required)
        :param str v: Query version
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: ArtifactResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.delete_query_with_http_info(client, project, artifact, **kwargs)  # noqa: E501

    def delete_query_with_http_info(self, client, project, artifact, **kwargs):  # noqa: E501
        """Delete query  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.delete_query_with_http_info(client, project, artifact, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param str artifact: Query name (required)
        :param str v: Query version
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(ArtifactResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['client', 'project', 'artifact', 'v']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_query" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `delete_query`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `delete_query`")  # noqa: E501
        # verify the required parameter 'artifact' is set
        if self.api_client.client_side_validation and ('artifact' not in local_var_params or  # noqa: E501
                                                        local_var_params['artifact'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `artifact` when calling `delete_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501
        if 'artifact' in local_var_params:
            path_params['artifact'] = local_var_params['artifact']  # noqa: E501

        query_params = []
        if 'v' in local_var_params and local_var_params['v'] is not None:  # noqa: E501
            query_params.append(('v', local_var_params['v']))  # 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 = ['api', 'jwt', 'oauth2']  # noqa: E501

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

    def execute_query(self, client, query_execute_request, **kwargs):  # noqa: E501
        """Execute live query  # noqa: E501

        Execute a live query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.execute_query(client, query_execute_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param QueryExecuteRequest query_execute_request: Query to execute (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.execute_query_with_http_info(client, query_execute_request, **kwargs)  # noqa: E501

    def execute_query_with_http_info(self, client, query_execute_request, **kwargs):  # noqa: E501
        """Execute live query  # noqa: E501

        Execute a live query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.execute_query_with_http_info(client, query_execute_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param QueryExecuteRequest query_execute_request: Query to execute (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(object, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method execute_query" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `execute_query`")  # noqa: E501
        # verify the required parameter 'query_execute_request' is set
        if self.api_client.client_side_validation and ('query_execute_request' not in local_var_params or  # noqa: E501
                                                        local_var_params['query_execute_request'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `query_execute_request` when calling `execute_query`")  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['api', 'jwt', 'oauth2']  # noqa: E501

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

    def get_query(self, client, project, artifact, **kwargs):  # noqa: E501
        """Get query  # noqa: E501

        Get a query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_query(client, project, artifact, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param str artifact: Query name (required)
        :param str v: Query version
        :param list[str] view: Fields to return in the results
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: UserQuery
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.get_query_with_http_info(client, project, artifact, **kwargs)  # noqa: E501

    def get_query_with_http_info(self, client, project, artifact, **kwargs):  # noqa: E501
        """Get query  # noqa: E501

        Get a query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_query_with_http_info(client, project, artifact, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param str artifact: Query name (required)
        :param str v: Query version
        :param list[str] view: Fields to return in the results
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(UserQuery, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['client', 'project', 'artifact', 'v', 'view']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_query" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `get_query`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `get_query`")  # noqa: E501
        # verify the required parameter 'artifact' is set
        if self.api_client.client_side_validation and ('artifact' not in local_var_params or  # noqa: E501
                                                        local_var_params['artifact'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `artifact` when calling `get_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501
        if 'artifact' in local_var_params:
            path_params['artifact'] = local_var_params['artifact']  # noqa: E501

        query_params = []
        if 'v' in local_var_params and local_var_params['v'] is not None:  # noqa: E501
            query_params.append(('v', local_var_params['v']))  # noqa: E501
        if 'view' in local_var_params and local_var_params['view'] is not None:  # noqa: E501
            query_params.append(('view', local_var_params['view']))  # noqa: E501
            collection_formats['view'] = '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 = ['api', 'jwt', 'oauth2']  # noqa: E501

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

    def list_queries(self, client, project, **kwargs):  # noqa: E501
        """List queries  # noqa: E501

        Get queries using optional simple filters  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_queries(client, project, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param list[str] view: Fields to return in the results
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: list[UserQuery]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.list_queries_with_http_info(client, project, **kwargs)  # noqa: E501

    def list_queries_with_http_info(self, client, project, **kwargs):  # noqa: E501
        """List queries  # noqa: E501

        Get queries using optional simple filters  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_queries_with_http_info(client, project, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param list[str] view: Fields to return in the results
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[UserQuery], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_queries" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `list_queries`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `list_queries`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501

        query_params = []
        if 'view' in local_var_params and local_var_params['view'] is not None:  # noqa: E501
            query_params.append(('view', local_var_params['view']))  # noqa: E501
            collection_formats['view'] = '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 = ['api', 'jwt', 'oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/query/{client}/{project}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[UserQuery]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def run_query(self, client, project, artifact, **kwargs):  # noqa: E501
        """Execute saved query  # noqa: E501

        Execute a saved query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.run_query(client, project, artifact, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param str artifact: Query name (required)
        :param str v: Query version
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.run_query_with_http_info(client, project, artifact, **kwargs)  # noqa: E501

    def run_query_with_http_info(self, client, project, artifact, **kwargs):  # noqa: E501
        """Execute saved query  # noqa: E501

        Execute a saved query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.run_query_with_http_info(client, project, artifact, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param str artifact: Query name (required)
        :param str v: Query version
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(object, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['client', 'project', 'artifact', 'v']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method run_query" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `run_query`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `run_query`")  # noqa: E501
        # verify the required parameter 'artifact' is set
        if self.api_client.client_side_validation and ('artifact' not in local_var_params or  # noqa: E501
                                                        local_var_params['artifact'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `artifact` when calling `run_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501
        if 'artifact' in local_var_params:
            path_params['artifact'] = local_var_params['artifact']  # noqa: E501

        query_params = []
        if 'v' in local_var_params and local_var_params['v'] is not None:  # noqa: E501
            query_params.append(('v', local_var_params['v']))  # 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 = ['api', 'jwt', 'oauth2']  # noqa: E501

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

    def save_query(self, client, project, user_query, **kwargs):  # noqa: E501
        """Save query  # noqa: E501

        Saves or creates a query (overwrite)  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.save_query(client, project, user_query, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param UserQuery user_query: Query to persist (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: UserQuery
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.save_query_with_http_info(client, project, user_query, **kwargs)  # noqa: E501

    def save_query_with_http_info(self, client, project, user_query, **kwargs):  # noqa: E501
        """Save query  # noqa: E501

        Saves or creates a query (overwrite)  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.save_query_with_http_info(client, project, user_query, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param UserQuery user_query: Query to persist (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(UserQuery, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method save_query" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `save_query`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `save_query`")  # noqa: E501
        # verify the required parameter 'user_query' is set
        if self.api_client.client_side_validation and ('user_query' not in local_var_params or  # noqa: E501
                                                        local_var_params['user_query'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `user_query` when calling `save_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['api', 'jwt', 'oauth2']  # noqa: E501

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

    def update_queries(self, client, project, update_artifact_request, **kwargs):  # noqa: E501
        """Update queries  # noqa: E501

        Updates multiple queries  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_queries(client, project, update_artifact_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param UpdateArtifactRequest update_artifact_request: Queries to update (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: ArtifactResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.update_queries_with_http_info(client, project, update_artifact_request, **kwargs)  # noqa: E501

    def update_queries_with_http_info(self, client, project, update_artifact_request, **kwargs):  # noqa: E501
        """Update queries  # noqa: E501

        Updates multiple queries  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_queries_with_http_info(client, project, update_artifact_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param UpdateArtifactRequest update_artifact_request: Queries to update (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(ArtifactResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_queries" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `update_queries`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `update_queries`")  # noqa: E501
        # verify the required parameter 'update_artifact_request' is set
        if self.api_client.client_side_validation and ('update_artifact_request' not in local_var_params or  # noqa: E501
                                                        local_var_params['update_artifact_request'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `update_artifact_request` when calling `update_queries`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['api', 'jwt', 'oauth2']  # noqa: E501

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

    def update_query(self, client, project, update_artifact_request, **kwargs):  # noqa: E501
        """Update query  # noqa: E501

        Updates one query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_query(client, project, update_artifact_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param UpdateArtifactRequest update_artifact_request: Query to update (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: ArtifactResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.update_query_with_http_info(client, project, update_artifact_request, **kwargs)  # noqa: E501

    def update_query_with_http_info(self, client, project, update_artifact_request, **kwargs):  # noqa: E501
        """Update query  # noqa: E501

        Updates one query  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.update_query_with_http_info(client, project, update_artifact_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str client: Client name (required)
        :param str project: Project name (required)
        :param UpdateArtifactRequest update_artifact_request: Query to update (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(ArtifactResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

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

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_query" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'client' is set
        if self.api_client.client_side_validation and ('client' not in local_var_params or  # noqa: E501
                                                        local_var_params['client'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `client` when calling `update_query`")  # noqa: E501
        # verify the required parameter 'project' is set
        if self.api_client.client_side_validation and ('project' not in local_var_params or  # noqa: E501
                                                        local_var_params['project'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `project` when calling `update_query`")  # noqa: E501
        # verify the required parameter 'update_artifact_request' is set
        if self.api_client.client_side_validation and ('update_artifact_request' not in local_var_params or  # noqa: E501
                                                        local_var_params['update_artifact_request'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `update_artifact_request` when calling `update_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'client' in local_var_params:
            path_params['client'] = local_var_params['client']  # noqa: E501
        if 'project' in local_var_params:
            path_params['project'] = local_var_params['project']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['api', 'jwt', 'oauth2']  # noqa: E501

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