# coding: utf-8

"""
    GraphDB Workbench API

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # 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 graphdb.graphdb_workbench.api_client import ApiClient


class LocationManagementControllerApi(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 activate_location_using_post(self, location_uri, **kwargs):  # noqa: E501
        """Activate a connected GraphDB location  # noqa: E501

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

        :param async_req bool
        :param LocationUri location_uri: locationUri (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.activate_location_using_post_with_http_info(location_uri, **kwargs)  # noqa: E501
        else:
            (data) = self.activate_location_using_post_with_http_info(location_uri, **kwargs)  # noqa: E501
            return data

    def activate_location_using_post_with_http_info(self, location_uri, **kwargs):  # noqa: E501
        """Activate a connected GraphDB location  # noqa: E501

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

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'location_uri' in params:
            body_params = params['location_uri']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain'])  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/rest/locations/activate', '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 add_location_using_post(self, location, **kwargs):  # noqa: E501
        """Connect to a remote GraphDB location  # noqa: E501

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

        :param async_req bool
        :param Location location: location (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.add_location_using_post_with_http_info(location, **kwargs)  # noqa: E501
        else:
            (data) = self.add_location_using_post_with_http_info(location, **kwargs)  # noqa: E501
            return data

    def add_location_using_post_with_http_info(self, location, **kwargs):  # noqa: E501
        """Connect to a remote GraphDB location  # noqa: E501

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

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'location' in params:
            body_params = params['location']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain'])  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/rest/locations', '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 change_location_using_put(self, location, **kwargs):  # noqa: E501
        """Modify settings for a connected GraphDB location  # noqa: E501

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

        :param async_req bool
        :param UpdatedLocation location: location (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.change_location_using_put_with_http_info(location, **kwargs)  # noqa: E501
        else:
            (data) = self.change_location_using_put_with_http_info(location, **kwargs)  # noqa: E501
            return data

    def change_location_using_put_with_http_info(self, location, **kwargs):  # noqa: E501
        """Modify settings for a connected GraphDB location  # noqa: E501

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

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'location' in params:
            body_params = params['location']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain'])  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/rest/locations', 'PUT',
            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 delete_location_using_delete(self, **kwargs):  # noqa: E501
        """Disconnect a GraphDB location  # noqa: E501

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

        :param async_req bool
        :param str uri: The GraphDB location URL
        :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.delete_location_using_delete_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.delete_location_using_delete_with_http_info(**kwargs)  # noqa: E501
            return data

    def delete_location_using_delete_with_http_info(self, **kwargs):  # noqa: E501
        """Disconnect a GraphDB location  # noqa: E501

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

        :param async_req bool
        :param str uri: The GraphDB location URL
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

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

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/rest/locations', 'DELETE',
            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 get_active_location_using_get(self, **kwargs):  # noqa: E501
        """Get active connected GraphDB location  # 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_active_location_using_get(async_req=True)
        >>> result = thread.get()

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

    def get_active_location_using_get_with_http_info(self, **kwargs):  # noqa: E501
        """Get active connected GraphDB location  # 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_active_location_using_get_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: Location
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/rest/locations/active', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Location',  # 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_all_using_get(self, **kwargs):  # noqa: E501
        """Get all connected GraphDB locations  # 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_all_using_get(async_req=True)
        >>> result = thread.get()

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

    def get_all_using_get_with_http_info(self, **kwargs):  # noqa: E501
        """Get all connected GraphDB locations  # 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_all_using_get_with_http_info(async_req=True)
        >>> result = thread.get()

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

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/rest/locations', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[Location]',  # 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 set_default_repository_using_post(self, default_repository_location, **kwargs):  # noqa: E501
        """Set default repository for active GraphDB location  # noqa: E501

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

        :param async_req bool
        :param DefaultRepositoryLocation default_repository_location: defaultRepositoryLocation (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.set_default_repository_using_post_with_http_info(default_repository_location, **kwargs)  # noqa: E501
        else:
            (data) = self.set_default_repository_using_post_with_http_info(default_repository_location, **kwargs)  # noqa: E501
            return data

    def set_default_repository_using_post_with_http_info(self, default_repository_location, **kwargs):  # noqa: E501
        """Set default repository for active GraphDB location  # noqa: E501

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

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'default_repository_location' in params:
            body_params = params['default_repository_location']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain'])  # 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 = []  # noqa: E501

        return self.api_client.call_api(
            '/rest/locations/active/default-repository', '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)
