# coding: utf-8

"""
    Trackside Software TeamDB API v2.0

    This API enables you to access TeamDB data  # noqa: E501

    OpenAPI spec version: 2.0
    Contact: support@trackside.fr
    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 teamdbapi.api_client import ApiClient


class TeamDBViewApi(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 team_db_view_get_fields_in_view(self, view_id, **kwargs):  # noqa: E501
        """Get the list of all fields contained inside a view  # noqa: E501

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

        :param async_req bool
        :param str view_id: The view id for which you want the fields list (required)
        :param bool find_in_subviews: True if you want to include the fields that are contained in the subviews
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.team_db_view_get_fields_in_view_with_http_info(view_id, **kwargs)  # noqa: E501
        else:
            (data) = self.team_db_view_get_fields_in_view_with_http_info(view_id, **kwargs)  # noqa: E501
            return data

    def team_db_view_get_fields_in_view_with_http_info(self, view_id, **kwargs):  # noqa: E501
        """Get the list of all fields contained inside a view  # noqa: E501

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

        :param async_req bool
        :param str view_id: The view id for which you want the fields list (required)
        :param bool find_in_subviews: True if you want to include the fields that are contained in the subviews
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['view_id', 'find_in_subviews']  # noqa: E501
        all_params.append('async_req')
        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 team_db_view_get_fields_in_view" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'view_id' is set
        if self.api_client.client_side_validation and ('view_id' not in params or
                                                       params['view_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `view_id` when calling `team_db_view_get_fields_in_view`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'view_id' in params:
            query_params.append(('viewId', params['view_id']))  # noqa: E501
        if 'find_in_subviews' in params:
            query_params.append(('findInSubviews', params['find_in_subviews']))  # 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', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/fieldsinsideview', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[CoupleGuidText]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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 team_db_view_get_layouts(self, **kwargs):  # noqa: E501
        """Get the list of all layouts  # noqa: E501

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

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

    def team_db_view_get_layouts_with_http_info(self, **kwargs):  # noqa: E501
        """Get the list of all layouts  # noqa: E501

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

        :param async_req bool
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        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 team_db_view_get_layouts" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/layouts', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[CoupleGuidText]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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 team_db_view_get_views(self, **kwargs):  # noqa: E501
        """Get the list of all views you are allowed to access  # noqa: E501

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

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

    def team_db_view_get_views_with_http_info(self, **kwargs):  # noqa: E501
        """Get the list of all views you are allowed to access  # noqa: E501

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

        :param async_req bool
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        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 team_db_view_get_views" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/views', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[CoupleGuidText]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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 team_db_view_get_views_from_layout(self, layout_id, **kwargs):  # noqa: E501
        """Get the list of all TeamDB views displayed in a layout  # noqa: E501

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

        :param async_req bool
        :param str layout_id: The TeamDB Layout unique identifier (required)
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.team_db_view_get_views_from_layout_with_http_info(layout_id, **kwargs)  # noqa: E501
        else:
            (data) = self.team_db_view_get_views_from_layout_with_http_info(layout_id, **kwargs)  # noqa: E501
            return data

    def team_db_view_get_views_from_layout_with_http_info(self, layout_id, **kwargs):  # noqa: E501
        """Get the list of all TeamDB views displayed in a layout  # noqa: E501

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

        :param async_req bool
        :param str layout_id: The TeamDB Layout unique identifier (required)
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['layout_id']  # noqa: E501
        all_params.append('async_req')
        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 team_db_view_get_views_from_layout" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'layout_id' is set
        if self.api_client.client_side_validation and ('layout_id' not in params or
                                                       params['layout_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `layout_id` when calling `team_db_view_get_views_from_layout`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'layout_id' in params:
            path_params['layoutId'] = params['layout_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', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/layout/{layoutId}/views', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[CoupleGuidText]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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 team_db_view_get_views_using_field(self, **kwargs):  # noqa: E501
        """Get the list of all views using a given modelfield  # noqa: E501

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

        :param async_req bool
        :param str field_id: The field id for which you want the views list
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.team_db_view_get_views_using_field_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.team_db_view_get_views_using_field_with_http_info(**kwargs)  # noqa: E501
            return data

    def team_db_view_get_views_using_field_with_http_info(self, **kwargs):  # noqa: E501
        """Get the list of all views using a given modelfield  # noqa: E501

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

        :param async_req bool
        :param str field_id: The field id for which you want the views list
        :return: list[CoupleGuidText]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['field_id']  # noqa: E501
        all_params.append('async_req')
        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 team_db_view_get_views_using_field" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'field_id' in params:
            query_params.append(('fieldId', params['field_id']))  # 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', 'text/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/viewusingfield', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[CoupleGuidText]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _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)
