# coding: utf-8

"""
    Yanport API

    ## À propos Voici quelques ressources qui vous aideront à explorer notre API, si vous avez des problèmes ou des demandes, veuillez contacter le [support](mailto:support@yanport.com). ## REST API Nos services webs utilisent le protocle **HTTPS** sur le port 443, tout accès en HTTP sur le port 80 est bloqué par notre pare-feu. Les échanges de données sont réalisés en **JSON**. ## Authentification Avant de commencer à explorer notre API, vous devez nous [contacter](https://www.yanport.com/contact) afin d'obtenir un [JSON Web Token](https://jwt.io) (**JWT**) qui vous permettra de vous identifier à chaque requêtes. ### JWT (header) La méthode privilégiée pour s'authentifier est de passer à chaque requêtes le token dans le header `Authorization: Bearer {{ JWT }}` en remplaçant `{{ JWT }}` par votre token. ### JWT (query param) Il est aussi possible de passer le token directement en query param de la requête `https://api.yanport.com/?token={{ JWT }}`. (_privilégié le passage par header en production._) ## Pour démarrer Lorsque vous disposez de votre token d'authentification, vous pouvez commencer à explorer notre API grâce au boutton  `Try it out` sur chacun de nos webs services. Mais au préalable, vous devez vous authentifier en cliquant sur le boutton `Authorize `, en remplissant l'input `api_key` avec `Bearer {{ JWT }}`.  **Exemple** `Bearer eyUEkiLCJh...CHCUiBfD63oxoo=` ## Limitation Toutes les requêtes à notre API sont loggées, c'est pourquoi vous devez respecter nos [CGU](https://dev.yanport.com/cgu) afin d'éviter tout usage abusif de notre API. 

    OpenAPI spec version: 1.0
    Contact: dev@yanport.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..configuration import Configuration
from ..api_client import ApiClient


class EtudesApi(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):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def studies_count_get(self, **kwargs):
        """
        Nombre d'études
        Compte le nombre d'études par rapport à certains critères de recherches.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_count_get(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param int _from: Début de la pagination
        :param int size: Nombre de résultats
        :param str sort: Trier par
        :param list[str] includes: Inclure un ou plusieurs élements par identifiant
        :param list[str] excludes: Exclure un ou plusieurs élements par identifiant
        :param list[int] user_ids: Liste d'identifiants d'utilisateurs
        :param list[str] external_user_ids: Liste d'identifiants externe client
        :param list[int] agency_ids: Liste d'identifiants d'agences
        :param list[str] external_agency_ids: Liste d'identifiants externes d'agences
        :param list[int] organization_ids: Liste d'identifiants d'organisations
        :param list[str] marketing_types: Liste de types de marché (vente, location, vente en viager)
        :param list[str] property_external_ids: Liste d'identifiants externes de biens
        :param datetime creation_date_min: Date minimale de création de l'étude
        :param datetime creation_date_max: Date limite de création de l'étude
        :return: CountResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.studies_count_get_with_http_info(**kwargs)
        else:
            (data) = self.studies_count_get_with_http_info(**kwargs)
            return data

    def studies_count_get_with_http_info(self, **kwargs):
        """
        Nombre d'études
        Compte le nombre d'études par rapport à certains critères de recherches.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_count_get_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param int _from: Début de la pagination
        :param int size: Nombre de résultats
        :param str sort: Trier par
        :param list[str] includes: Inclure un ou plusieurs élements par identifiant
        :param list[str] excludes: Exclure un ou plusieurs élements par identifiant
        :param list[int] user_ids: Liste d'identifiants d'utilisateurs
        :param list[str] external_user_ids: Liste d'identifiants externe client
        :param list[int] agency_ids: Liste d'identifiants d'agences
        :param list[str] external_agency_ids: Liste d'identifiants externes d'agences
        :param list[int] organization_ids: Liste d'identifiants d'organisations
        :param list[str] marketing_types: Liste de types de marché (vente, location, vente en viager)
        :param list[str] property_external_ids: Liste d'identifiants externes de biens
        :param datetime creation_date_min: Date minimale de création de l'étude
        :param datetime creation_date_max: Date limite de création de l'étude
        :return: CountResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['_from', 'size', 'sort', 'includes', 'excludes', 'user_ids', 'external_user_ids', 'agency_ids', 'external_agency_ids', 'organization_ids', 'marketing_types', 'property_external_ids', 'creation_date_min', 'creation_date_max']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method studies_count_get" % key
                )
            params[key] = val
        del params['kwargs']

        if '_from' in params and params['_from'] < 0:
            raise ValueError("Invalid value for parameter `_from` when calling `studies_count_get`, must be a value greater than or equal to `0`")
        if 'size' in params and params['size'] > 1000:
            raise ValueError("Invalid value for parameter `size` when calling `studies_count_get`, must be a value less than or equal to `1000`")
        if 'size' in params and params['size'] < 0:
            raise ValueError("Invalid value for parameter `size` when calling `studies_count_get`, must be a value greater than or equal to `0`")

        collection_formats = {}

        path_params = {}

        query_params = []
        if '_from' in params:
            query_params.append(('from', params['_from']))
        if 'size' in params:
            query_params.append(('size', params['size']))
        if 'sort' in params:
            query_params.append(('sort', params['sort']))
        if 'includes' in params:
            query_params.append(('includes', params['includes']))
            collection_formats['includes'] = 'multi'
        if 'excludes' in params:
            query_params.append(('excludes', params['excludes']))
            collection_formats['excludes'] = 'multi'
        if 'user_ids' in params:
            query_params.append(('userIds', params['user_ids']))
            collection_formats['userIds'] = 'csv'
        if 'external_user_ids' in params:
            query_params.append(('externalUserIds', params['external_user_ids']))
            collection_formats['externalUserIds'] = 'csv'
        if 'agency_ids' in params:
            query_params.append(('agencyIds', params['agency_ids']))
            collection_formats['agencyIds'] = 'csv'
        if 'external_agency_ids' in params:
            query_params.append(('externalAgencyIds', params['external_agency_ids']))
            collection_formats['externalAgencyIds'] = 'csv'
        if 'organization_ids' in params:
            query_params.append(('organizationIds', params['organization_ids']))
            collection_formats['organizationIds'] = 'csv'
        if 'marketing_types' in params:
            query_params.append(('marketingTypes', params['marketing_types']))
            collection_formats['marketingTypes'] = 'csv'
        if 'property_external_ids' in params:
            query_params.append(('propertyExternalIds', params['property_external_ids']))
            collection_formats['propertyExternalIds'] = 'csv'
        if 'creation_date_min' in params:
            query_params.append(('creationDateMin', params['creation_date_min']))
        if 'creation_date_max' in params:
            query_params.append(('creationDateMax', params['creation_date_max']))

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['jwt']

        return self.api_client.call_api('/studies/count', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='CountResponse',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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 studies_get(self, **kwargs):
        """
        Rechercher des études
        Rechercher des études selon plusieurs critères
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_get(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param int _from: Début de la pagination
        :param int size: Nombre de résultats
        :param str sort: Trier par
        :param list[str] includes: Inclure un ou plusieurs élements par identifiant
        :param list[str] excludes: Exclure un ou plusieurs élements par identifiant
        :param list[int] user_ids: Liste d'identifiants d'utilisateurs
        :param list[str] external_user_ids: Liste d'identifiants externe client
        :param list[int] agency_ids: Liste d'identifiants d'agences
        :param list[str] external_agency_ids: Liste d'identifiants externes d'agences
        :param list[int] organization_ids: Liste d'identifiants d'organisations
        :param list[str] marketing_types: Liste de types de marché (vente, location, vente en viager)
        :param list[str] property_external_ids: Liste d'identifiants externes de biens
        :param datetime creation_date_min: Date minimale de création de l'étude
        :param datetime creation_date_max: Date limite de création de l'étude
        :return: InlineResponse2007
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.studies_get_with_http_info(**kwargs)
        else:
            (data) = self.studies_get_with_http_info(**kwargs)
            return data

    def studies_get_with_http_info(self, **kwargs):
        """
        Rechercher des études
        Rechercher des études selon plusieurs critères
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_get_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param int _from: Début de la pagination
        :param int size: Nombre de résultats
        :param str sort: Trier par
        :param list[str] includes: Inclure un ou plusieurs élements par identifiant
        :param list[str] excludes: Exclure un ou plusieurs élements par identifiant
        :param list[int] user_ids: Liste d'identifiants d'utilisateurs
        :param list[str] external_user_ids: Liste d'identifiants externe client
        :param list[int] agency_ids: Liste d'identifiants d'agences
        :param list[str] external_agency_ids: Liste d'identifiants externes d'agences
        :param list[int] organization_ids: Liste d'identifiants d'organisations
        :param list[str] marketing_types: Liste de types de marché (vente, location, vente en viager)
        :param list[str] property_external_ids: Liste d'identifiants externes de biens
        :param datetime creation_date_min: Date minimale de création de l'étude
        :param datetime creation_date_max: Date limite de création de l'étude
        :return: InlineResponse2007
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['_from', 'size', 'sort', 'includes', 'excludes', 'user_ids', 'external_user_ids', 'agency_ids', 'external_agency_ids', 'organization_ids', 'marketing_types', 'property_external_ids', 'creation_date_min', 'creation_date_max']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method studies_get" % key
                )
            params[key] = val
        del params['kwargs']

        if '_from' in params and params['_from'] < 0:
            raise ValueError("Invalid value for parameter `_from` when calling `studies_get`, must be a value greater than or equal to `0`")
        if 'size' in params and params['size'] > 1000:
            raise ValueError("Invalid value for parameter `size` when calling `studies_get`, must be a value less than or equal to `1000`")
        if 'size' in params and params['size'] < 0:
            raise ValueError("Invalid value for parameter `size` when calling `studies_get`, must be a value greater than or equal to `0`")

        collection_formats = {}

        path_params = {}

        query_params = []
        if '_from' in params:
            query_params.append(('from', params['_from']))
        if 'size' in params:
            query_params.append(('size', params['size']))
        if 'sort' in params:
            query_params.append(('sort', params['sort']))
        if 'includes' in params:
            query_params.append(('includes', params['includes']))
            collection_formats['includes'] = 'multi'
        if 'excludes' in params:
            query_params.append(('excludes', params['excludes']))
            collection_formats['excludes'] = 'multi'
        if 'user_ids' in params:
            query_params.append(('userIds', params['user_ids']))
            collection_formats['userIds'] = 'csv'
        if 'external_user_ids' in params:
            query_params.append(('externalUserIds', params['external_user_ids']))
            collection_formats['externalUserIds'] = 'csv'
        if 'agency_ids' in params:
            query_params.append(('agencyIds', params['agency_ids']))
            collection_formats['agencyIds'] = 'csv'
        if 'external_agency_ids' in params:
            query_params.append(('externalAgencyIds', params['external_agency_ids']))
            collection_formats['externalAgencyIds'] = 'csv'
        if 'organization_ids' in params:
            query_params.append(('organizationIds', params['organization_ids']))
            collection_formats['organizationIds'] = 'csv'
        if 'marketing_types' in params:
            query_params.append(('marketingTypes', params['marketing_types']))
            collection_formats['marketingTypes'] = 'csv'
        if 'property_external_ids' in params:
            query_params.append(('propertyExternalIds', params['property_external_ids']))
            collection_formats['propertyExternalIds'] = 'csv'
        if 'creation_date_min' in params:
            query_params.append(('creationDateMin', params['creation_date_min']))
        if 'creation_date_max' in params:
            query_params.append(('creationDateMax', params['creation_date_max']))

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['jwt']

        return self.api_client.call_api('/studies', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='InlineResponse2007',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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 studies_id_delete(self, id, **kwargs):
        """
        Supprimer une étude
        Supprimer une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_delete(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: DefaultResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.studies_id_delete_with_http_info(id, **kwargs)
        else:
            (data) = self.studies_id_delete_with_http_info(id, **kwargs)
            return data

    def studies_id_delete_with_http_info(self, id, **kwargs):
        """
        Supprimer une étude
        Supprimer une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_delete_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: DefaultResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method studies_id_delete" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if ('id' not in params) or (params['id'] is None):
            raise ValueError("Missing the required parameter `id` when calling `studies_id_delete`")


        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']

        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'])

        # Authentication setting
        auth_settings = ['jwt']

        return self.api_client.call_api('/studies/{id}', 'DELETE',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='DefaultResponse',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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 studies_id_duplicate_get(self, id, **kwargs):
        """
        Dupliquer une étude
        Dupliquer une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_duplicate_get(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.studies_id_duplicate_get_with_http_info(id, **kwargs)
        else:
            (data) = self.studies_id_duplicate_get_with_http_info(id, **kwargs)
            return data

    def studies_id_duplicate_get_with_http_info(self, id, **kwargs):
        """
        Dupliquer une étude
        Dupliquer une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_duplicate_get_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method studies_id_duplicate_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if ('id' not in params) or (params['id'] is None):
            raise ValueError("Missing the required parameter `id` when calling `studies_id_duplicate_get`")


        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']

        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'])

        # Authentication setting
        auth_settings = ['jwt']

        return self.api_client.call_api('/studies/{id}/duplicate', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='Study',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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 studies_id_get(self, id, **kwargs):
        """
        Récupérer une étude
        Récupérer une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_get(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.studies_id_get_with_http_info(id, **kwargs)
        else:
            (data) = self.studies_id_get_with_http_info(id, **kwargs)
            return data

    def studies_id_get_with_http_info(self, id, **kwargs):
        """
        Récupérer une étude
        Récupérer une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_get_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method studies_id_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if ('id' not in params) or (params['id'] is None):
            raise ValueError("Missing the required parameter `id` when calling `studies_id_get`")


        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']

        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'])

        # Authentication setting
        auth_settings = ['jwt']

        return self.api_client.call_api('/studies/{id}', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='Study',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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 studies_id_put(self, id, **kwargs):
        """
        Mettre à jour une étude
        Mettre à jour une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_put(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.studies_id_put_with_http_info(id, **kwargs)
        else:
            (data) = self.studies_id_put_with_http_info(id, **kwargs)
            return data

    def studies_id_put_with_http_info(self, id, **kwargs):
        """
        Mettre à jour une étude
        Mettre à jour une étude par son identifiant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_id_put_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: L'identifiant de l'étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method studies_id_put" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'id' is set
        if ('id' not in params) or (params['id'] is None):
            raise ValueError("Missing the required parameter `id` when calling `studies_id_put`")


        collection_formats = {}

        path_params = {}
        if 'id' in params:
            path_params['id'] = params['id']

        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'])

        # Authentication setting
        auth_settings = ['jwt']

        return self.api_client.call_api('/studies/{id}', 'PUT',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='Study',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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 studies_post(self, body, **kwargs):
        """
        Créer une étude
        Retourne l'étude créé
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_post(body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param Body2 body: Formulaire pour la création d'une étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.studies_post_with_http_info(body, **kwargs)
        else:
            (data) = self.studies_post_with_http_info(body, **kwargs)
            return data

    def studies_post_with_http_info(self, body, **kwargs):
        """
        Créer une étude
        Retourne l'étude créé
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.studies_post_with_http_info(body, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param Body2 body: Formulaire pour la création d'une étude (required)
        :return: Study
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['body']
        all_params.append('callback')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method studies_post" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'body' is set
        if ('body' not in params) or (params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `studies_post`")


        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])

        # Authentication setting
        auth_settings = ['jwt']

        return self.api_client.call_api('/studies', 'POST',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='Study',
                                        auth_settings=auth_settings,
                                        callback=params.get('callback'),
                                        _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)
