# 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 RevisionApi(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 revision_create_revision(self, version_id, revision, **kwargs):  # noqa: E501
        """Create a revision. You have to specify a version id to which the revision is created.  This is mandatory because the system needs to ensure that the revision data are consistent with the version definition.  # noqa: E501

        Set the Revision.Id to empty (00000000-0000-0000-0000-000000000000), it will be generated by the server.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.revision_create_revision(version_id, revision, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str version_id: The version id to which the revision was created (required)
        :param Revision revision: The revision you want to create (required)
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_create_revision_with_http_info(version_id, revision, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_create_revision_with_http_info(version_id, revision, **kwargs)  # noqa: E501
            return data

    def revision_create_revision_with_http_info(self, version_id, revision, **kwargs):  # noqa: E501
        """Create a revision. You have to specify a version id to which the revision is created.  This is mandatory because the system needs to ensure that the revision data are consistent with the version definition.  # noqa: E501

        Set the Revision.Id to empty (00000000-0000-0000-0000-000000000000), it will be generated by the server.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.revision_create_revision_with_http_info(version_id, revision, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str version_id: The version id to which the revision was created (required)
        :param Revision revision: The revision you want to create (required)
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/version/{versionId}/revision', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Revision',  # 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 revision_delete_revision(self, revision_id, **kwargs):  # noqa: E501
        """Remove a revision corresponding to a given id.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The revision id you want to remove (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_delete_revision_with_http_info(revision_id, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_delete_revision_with_http_info(revision_id, **kwargs)  # noqa: E501
            return data

    def revision_delete_revision_with_http_info(self, revision_id, **kwargs):  # noqa: E501
        """Remove a revision corresponding to a given id.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The revision id you want to remove (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'revision_id' in params:
            path_params['revisionId'] = params['revision_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/revision/{revisionId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_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 revision_export_revision(self, revision_id, version_id, output_file_path, **kwargs):  # noqa: E501
        """[Command] Export a revision into a file. You need to specify the version to which you want to export the revision value.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The revision id to export. (required)
        :param str version_id: The version id to which you want to export the revision value. (required)
        :param str output_file_path: The path to the file to create. You have to provide the file extension for example : MyFile.m (required)
        :return: bool
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_export_revision_with_http_info(revision_id, version_id, output_file_path, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_export_revision_with_http_info(revision_id, version_id, output_file_path, **kwargs)  # noqa: E501
            return data

    def revision_export_revision_with_http_info(self, revision_id, version_id, output_file_path, **kwargs):  # noqa: E501
        """[Command] Export a revision into a file. You need to specify the version to which you want to export the revision value.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The revision id to export. (required)
        :param str version_id: The version id to which you want to export the revision value. (required)
        :param str output_file_path: The path to the file to create. You have to provide the file extension for example : MyFile.m (required)
        :return: bool
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'version_id' in params:
            query_params.append(('versionId', params['version_id']))  # noqa: E501
        if 'output_file_path' in params:
            query_params.append(('outputFilePath', params['output_file_path']))  # 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/revision/{revisionId}/export', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='bool',  # 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 revision_get_revision(self, revision_id, **kwargs):  # noqa: E501
        """Get a revision corresponding to a unique Id.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The unique revision id to which you want to get the revision (required)
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_get_revision_with_http_info(revision_id, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_get_revision_with_http_info(revision_id, **kwargs)  # noqa: E501
            return data

    def revision_get_revision_with_http_info(self, revision_id, **kwargs):  # noqa: E501
        """Get a revision corresponding to a unique Id.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The unique revision id to which you want to get the revision (required)
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'revision_id' in params:
            path_params['revisionId'] = params['revision_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/revision/{revisionId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Revision',  # 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 revision_get_revision_by_param_and_assembly(self, assembly_id, parameter_id, **kwargs):  # noqa: E501
        """Get the revision selected in an assembly for a given parameter.  # noqa: E501

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

        :param async_req bool
        :param str assembly_id: The assembly id to which you want to get the revision value (required)
        :param str parameter_id: The parameter id to which you want the revisions (required)
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_get_revision_by_param_and_assembly_with_http_info(assembly_id, parameter_id, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_get_revision_by_param_and_assembly_with_http_info(assembly_id, parameter_id, **kwargs)  # noqa: E501
            return data

    def revision_get_revision_by_param_and_assembly_with_http_info(self, assembly_id, parameter_id, **kwargs):  # noqa: E501
        """Get the revision selected in an assembly for a given parameter.  # noqa: E501

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

        :param async_req bool
        :param str assembly_id: The assembly id to which you want to get the revision value (required)
        :param str parameter_id: The parameter id to which you want the revisions (required)
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'assembly_id' in params:
            path_params['assemblyId'] = params['assembly_id']  # noqa: E501
        if 'parameter_id' in params:
            path_params['parameterId'] = params['parameter_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/assembly/{assemblyId}/parameter/{parameterId}/revision', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Revision',  # 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 revision_get_revisions(self, version_id, **kwargs):  # noqa: E501
        """Get all the revisions for a given version. This will retreive all revisions for all the parameters of a given version.  Only revisions that match the version definition will be returned.  # noqa: E501

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

        :param async_req bool
        :param str version_id: The version id to which you want all the revisions (required)
        :return: list[Revision]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_get_revisions_with_http_info(version_id, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_get_revisions_with_http_info(version_id, **kwargs)  # noqa: E501
            return data

    def revision_get_revisions_with_http_info(self, version_id, **kwargs):  # noqa: E501
        """Get all the revisions for a given version. This will retreive all revisions for all the parameters of a given version.  Only revisions that match the version definition will be returned.  # noqa: E501

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

        :param async_req bool
        :param str version_id: The version id to which you want all the revisions (required)
        :return: list[Revision]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'version_id' in params:
            path_params['versionId'] = params['version_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/version/{versionId}/revisions', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[Revision]',  # 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 revision_get_revisions(self, parameter_id, version_id, **kwargs):  # noqa: E501
        """Get all revisions for a given parameter and version. You need to specify a version in order to  get the revisions that match the version definition (size, format...)  # noqa: E501

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

        :param async_req bool
        :param str parameter_id: The parameter id to which you want the revisions (required)
        :param str version_id: The version id to which you want to get the revision value (required)
        :return: list[Revision]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_get_revisions_with_http_info(parameter_id, version_id, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_get_revisions_with_http_info(parameter_id, version_id, **kwargs)  # noqa: E501
            return data

    def revision_get_revisions_with_http_info(self, parameter_id, version_id, **kwargs):  # noqa: E501
        """Get all revisions for a given parameter and version. You need to specify a version in order to  get the revisions that match the version definition (size, format...)  # noqa: E501

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

        :param async_req bool
        :param str parameter_id: The parameter id to which you want the revisions (required)
        :param str version_id: The version id to which you want to get the revision value (required)
        :return: list[Revision]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'parameter_id' in params:
            path_params['parameterId'] = params['parameter_id']  # noqa: E501
        if 'version_id' in params:
            path_params['versionId'] = params['version_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/version/{versionId}/parameter/{parameterId}/revisions', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[Revision]',  # 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 revision_try_get_revision(self, version_id, revision, **kwargs):  # noqa: E501
        """Check whether the revision with the same data already exists for a given version.  Returns the revision unique ID already existing or empty (00000000-0000-0000-0000-000000000000) if not found.  # noqa: E501

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

        :param async_req bool
        :param str version_id: The version id to which the revision must belong (required)
        :param Revision revision: The revision you want to check. The research is based on the data not the revision id. (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_try_get_revision_with_http_info(version_id, revision, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_try_get_revision_with_http_info(version_id, revision, **kwargs)  # noqa: E501
            return data

    def revision_try_get_revision_with_http_info(self, version_id, revision, **kwargs):  # noqa: E501
        """Check whether the revision with the same data already exists for a given version.  Returns the revision unique ID already existing or empty (00000000-0000-0000-0000-000000000000) if not found.  # noqa: E501

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

        :param async_req bool
        :param str version_id: The version id to which the revision must belong (required)
        :param Revision revision: The revision you want to check. The research is based on the data not the revision id. (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/version/{versionId}/revision/exists', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='str',  # 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 revision_update_revision(self, revision_id, version_id, revision, **kwargs):  # noqa: E501
        """Update a revision. You have to specify a version id to which the revision is updated.  This is mandatory because the system needs to ensure that the revision data are consistent with the version definition.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The revision id corresponding to the revision you want to update (required)
        :param str version_id: The version id to which the revision was created (required)
        :param Revision revision: The revision you want to update (required)
        :param bool allow_update_revision_fields: Allows to update the all the revision description fields except the data from a locked revision.
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.revision_update_revision_with_http_info(revision_id, version_id, revision, **kwargs)  # noqa: E501
        else:
            (data) = self.revision_update_revision_with_http_info(revision_id, version_id, revision, **kwargs)  # noqa: E501
            return data

    def revision_update_revision_with_http_info(self, revision_id, version_id, revision, **kwargs):  # noqa: E501
        """Update a revision. You have to specify a version id to which the revision is updated.  This is mandatory because the system needs to ensure that the revision data are consistent with the version definition.  # noqa: E501

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

        :param async_req bool
        :param str revision_id: The revision id corresponding to the revision you want to update (required)
        :param str version_id: The version id to which the revision was created (required)
        :param Revision revision: The revision you want to update (required)
        :param bool allow_update_revision_fields: Allows to update the all the revision description fields except the data from a locked revision.
        :return: Revision
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'revision_id' in params:
            path_params['revisionId'] = params['revision_id']  # noqa: E501
        if 'version_id' in params:
            path_params['versionId'] = params['version_id']  # noqa: E501

        query_params = []
        if 'allow_update_revision_fields' in params:
            query_params.append(('allowUpdateRevisionFields', params['allow_update_revision_fields']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/teamdbapi/v2.0/version/{versionId}/revision/{revisionId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Revision',  # 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)
