# coding: utf-8

"""
    PSI Candidate Rest Eligibility Service

    PSIs REST based service to modify candidate test eligibilities.  # noqa: E501

    OpenAPI spec version: 1.0.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from psi_eligibility.api_client import ApiClient


class DefaultApi(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 cancel_candidate_eligibility(self, account_code, candidate_id, test_code, **kwargs):  # noqa: E501
        """Cancel a candidate's eligibility record.  # noqa: E501

        Cancels the eligibility matching the supplied candidate eligiblity code.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.cancel_candidate_eligibility(account_code, candidate_id, test_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: The unique candidate id to act on. (required)
        :param str test_code: The test code. (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.cancel_candidate_eligibility_with_http_info(account_code, candidate_id, test_code, **kwargs)  # noqa: E501
        else:
            (data) = self.cancel_candidate_eligibility_with_http_info(account_code, candidate_id, test_code, **kwargs)  # noqa: E501
            return data

    def cancel_candidate_eligibility_with_http_info(self, account_code, candidate_id, test_code, **kwargs):  # noqa: E501
        """Cancel a candidate's eligibility record.  # noqa: E501

        Cancels the eligibility matching the supplied candidate eligiblity code.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.cancel_candidate_eligibility_with_http_info(account_code, candidate_id, test_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: The unique candidate id to act on. (required)
        :param str test_code: The test code. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'account_code' in params:
            path_params['account_code'] = params['account_code']  # noqa: E501
        if 'candidate_id' in params:
            path_params['candidate_id'] = params['candidate_id']  # noqa: E501
        if 'test_code' in params:
            path_params['test_code'] = params['test_code']  # 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; charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth']  # noqa: E501

        return self.api_client.call_api(
            '/accounts/{account_code}/candidates/{candidate_id}/tests/{test_code}', '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 create_candidate(self, account_code, payload, **kwargs):  # noqa: E501
        """Create a new candidate eligibility record.  # noqa: E501

        Submits a single eligibilites to the PSI Atlas system. Many parameters are optional but the more the better.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_candidate(account_code, payload, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param EligibilityModel payload: A new eligibility record. (required)
        :return: EligibilityResponseModel
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_candidate_with_http_info(account_code, payload, **kwargs)  # noqa: E501
        else:
            (data) = self.create_candidate_with_http_info(account_code, payload, **kwargs)  # noqa: E501
            return data

    def create_candidate_with_http_info(self, account_code, payload, **kwargs):  # noqa: E501
        """Create a new candidate eligibility record.  # noqa: E501

        Submits a single eligibilites to the PSI Atlas system. Many parameters are optional but the more the better.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_candidate_with_http_info(account_code, payload, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param EligibilityModel payload: A new eligibility record. (required)
        :return: EligibilityResponseModel
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'payload' in params:
            body_params = params['payload']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json; charset=UTF-8'])  # noqa: E501

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

        # Authentication setting
        auth_settings = ['oauth']  # noqa: E501

        return self.api_client.call_api(
            '/accounts/{account_code}/candidates', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='EligibilityResponseModel',  # 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 get_candidate(self, account_code, candidate_id, **kwargs):  # noqa: E501
        """Get the eligiblities associated with the candidate id.  # noqa: E501

        Get's all of the eligibilities associated with the supplied candidate_id. This is useful to decide which specific eligibility needs to be updated or deleted.  # 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_candidate(account_code, candidate_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: the candidate id. (required)
        :return: list[ExistingEligibilityModel]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_candidate_with_http_info(account_code, candidate_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_candidate_with_http_info(account_code, candidate_id, **kwargs)  # noqa: E501
            return data

    def get_candidate_with_http_info(self, account_code, candidate_id, **kwargs):  # noqa: E501
        """Get the eligiblities associated with the candidate id.  # noqa: E501

        Get's all of the eligibilities associated with the supplied candidate_id. This is useful to decide which specific eligibility needs to be updated or deleted.  # 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_candidate_with_http_info(account_code, candidate_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: the candidate id. (required)
        :return: list[ExistingEligibilityModel]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'account_code' in params:
            path_params['account_code'] = params['account_code']  # noqa: E501
        if 'candidate_id' in params:
            path_params['candidate_id'] = params['candidate_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; charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth']  # noqa: E501

        return self.api_client.call_api(
            '/accounts/{account_code}/candidates/{candidate_id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[ExistingEligibilityModel]',  # 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 get_candidate_eligibilities(self, account_code, candidate_id, test_code, **kwargs):  # noqa: E501
        """Get the eligiblities associated with the candidate id.  # noqa: E501

        Get's all of the eligibilities associated with the supplied candidate_id fpr a specific test code.  # 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_candidate_eligibilities(account_code, candidate_id, test_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: the candidate id. (required)
        :param str test_code: The test code. (required)
        :return: list[ExistingEligibilityModel]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_candidate_eligibilities_with_http_info(account_code, candidate_id, test_code, **kwargs)  # noqa: E501
        else:
            (data) = self.get_candidate_eligibilities_with_http_info(account_code, candidate_id, test_code, **kwargs)  # noqa: E501
            return data

    def get_candidate_eligibilities_with_http_info(self, account_code, candidate_id, test_code, **kwargs):  # noqa: E501
        """Get the eligiblities associated with the candidate id.  # noqa: E501

        Get's all of the eligibilities associated with the supplied candidate_id fpr a specific test code.  # 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_candidate_eligibilities_with_http_info(account_code, candidate_id, test_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: the candidate id. (required)
        :param str test_code: The test code. (required)
        :return: list[ExistingEligibilityModel]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'account_code' in params:
            path_params['account_code'] = params['account_code']  # noqa: E501
        if 'candidate_id' in params:
            path_params['candidate_id'] = params['candidate_id']  # noqa: E501
        if 'test_code' in params:
            path_params['test_code'] = params['test_code']  # 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; charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth']  # noqa: E501

        return self.api_client.call_api(
            '/accounts/{account_code}/candidates/{candidate_id}/tests/{test_code}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[ExistingEligibilityModel]',  # 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 get_test_launch_info(self, psi_eligibility_code, **kwargs):  # noqa: E501
        """GET test launch url  # noqa: E501

        API endpoint to retrieve the test launch URL for a given eligibility code.  # 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_test_launch_info(psi_eligibility_code, async_req=True)
        >>> result = thread.get()

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

    def get_test_launch_info_with_http_info(self, psi_eligibility_code, **kwargs):  # noqa: E501
        """GET test launch url  # noqa: E501

        API endpoint to retrieve the test launch URL for a given eligibility code.  # 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_test_launch_info_with_http_info(psi_eligibility_code, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str psi_eligibility_code: (required)
        :return: TestLaunchInfoModel
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['oauth']  # noqa: E501

        return self.api_client.call_api(
            '/eligibilities/{psi_eligibility_code}/testLaunchInfo', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TestLaunchInfoModel',  # 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 modify_vouchers_of_eligibility(self, account_code, candidate_id, test_code, **kwargs):  # noqa: E501
        """Associate a set of voucher codes to PSI Candidate Test Eligibility record. Previously attached vouchers to the eligibility record but not listed in the input would be unlinked from the eligibility record. Voucher Codes are agreed upon codes between PSI and the customer (identified by account_code)  # noqa: E501

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

        :param async_req bool
        :param str account_code: Account code or the customer code (required)
        :param str candidate_id: Candidate Id (required)
        :param str test_code: Test Code (required)
        :param list[str] payload: Voucher Codes to be applied to the candidate's specified exam record
        :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.modify_vouchers_of_eligibility_with_http_info(account_code, candidate_id, test_code, **kwargs)  # noqa: E501
        else:
            (data) = self.modify_vouchers_of_eligibility_with_http_info(account_code, candidate_id, test_code, **kwargs)  # noqa: E501
            return data

    def modify_vouchers_of_eligibility_with_http_info(self, account_code, candidate_id, test_code, **kwargs):  # noqa: E501
        """Associate a set of voucher codes to PSI Candidate Test Eligibility record. Previously attached vouchers to the eligibility record but not listed in the input would be unlinked from the eligibility record. Voucher Codes are agreed upon codes between PSI and the customer (identified by account_code)  # noqa: E501

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

        :param async_req bool
        :param str account_code: Account code or the customer code (required)
        :param str candidate_id: Candidate Id (required)
        :param str test_code: Test Code (required)
        :param list[str] payload: Voucher Codes to be applied to the candidate's specified exam record
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'account_code' in params:
            path_params['account_code'] = params['account_code']  # noqa: E501
        if 'candidate_id' in params:
            path_params['candidate_id'] = params['candidate_id']  # noqa: E501
        if 'test_code' in params:
            path_params['test_code'] = params['test_code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'payload' in params:
            body_params = params['payload']
        # 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 = ['oauth']  # noqa: E501

        return self.api_client.call_api(
            '/accounts/{account_code}/candidates/{candidate_id}/tests/{test_code}/vouchers', 'PUT',
            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 update_candidate_eligibility(self, account_code, candidate_id, test_code, payload, **kwargs):  # noqa: E501
        """Update an existing candidate's eligibility record.  # noqa: E501

        Update an existing candidate's eligibility details. Information such as candidate demographic data and eligibility, expiration and scheduled start date may be changed. You cannot change the associated test via this call. To do so you must cancel and create a new eligibility.  # 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_candidate_eligibility(account_code, candidate_id, test_code, payload, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: The unique candidate id to update. (required)
        :param str test_code: The test code. (required)
        :param EligibilityModel payload: The candidate's updated eligibity record. (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.update_candidate_eligibility_with_http_info(account_code, candidate_id, test_code, payload, **kwargs)  # noqa: E501
        else:
            (data) = self.update_candidate_eligibility_with_http_info(account_code, candidate_id, test_code, payload, **kwargs)  # noqa: E501
            return data

    def update_candidate_eligibility_with_http_info(self, account_code, candidate_id, test_code, payload, **kwargs):  # noqa: E501
        """Update an existing candidate's eligibility record.  # noqa: E501

        Update an existing candidate's eligibility details. Information such as candidate demographic data and eligibility, expiration and scheduled start date may be changed. You cannot change the associated test via this call. To do so you must cancel and create a new eligibility.  # 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_candidate_eligibility_with_http_info(account_code, candidate_id, test_code, payload, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str account_code: provided client specific account code. (required)
        :param str candidate_id: The unique candidate id to update. (required)
        :param str test_code: The test code. (required)
        :param EligibilityModel payload: The candidate's updated eligibity record. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'account_code' in params:
            path_params['account_code'] = params['account_code']  # noqa: E501
        if 'candidate_id' in params:
            path_params['candidate_id'] = params['candidate_id']  # noqa: E501
        if 'test_code' in params:
            path_params['test_code'] = params['test_code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'payload' in params:
            body_params = params['payload']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json; charset=UTF-8'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth']  # noqa: E501

        return self.api_client.call_api(
            '/accounts/{account_code}/candidates/{candidate_id}/tests/{test_code}', 'PUT',
            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)
