# coding: utf-8

"""
    SCORM Cloud Rest API

    REST API used for SCORM Cloud integrations.  # noqa: E501

    OpenAPI spec version: 2.0
    Contact: systems@rusticisoftware.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import
from deprecated import deprecated

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from rustici_software_cloud_v2.api_client import ApiClient


class ContentConnectorsApi(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 create_connector(self, connector, **kwargs):  # noqa: E501
        """create_connector  # noqa: E501

        A call to this method will create a new content connector and return a newly created Id for it.   # 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_connector(connector, async_req=True)
        >>> result = thread.get()

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

    def create_connector_with_http_info(self, connector, **kwargs):  # noqa: E501
        """create_connector  # noqa: E501

        A call to this method will create a new content connector and return a newly created Id for it.   # 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_connector_with_http_info(connector, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateConnectorSchema connector: (required)
        :return: StringResultSchema
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'connector' in params:
            body_params = params['connector']
        # 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 = ['APP_NORMAL', 'OAUTH']  # noqa: E501

        return self.api_client.call_api(
            '/contentConnectors', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='StringResultSchema',  # 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_connector(self, connector_id, **kwargs):  # noqa: E501
        """Delete a connector   # noqa: E501

        Delete the specified connector.   # 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_connector(connector_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connector_id: the connector id (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.delete_connector_with_http_info(connector_id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_connector_with_http_info(connector_id, **kwargs)  # noqa: E501
            return data

    def delete_connector_with_http_info(self, connector_id, **kwargs):  # noqa: E501
        """Delete a connector   # noqa: E501

        Delete the specified connector.   # 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_connector_with_http_info(connector_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connector_id: the connector id (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'connector_id' in params:
            path_params['connectorId'] = params['connector_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'])  # 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 = ['APP_NORMAL', 'OAUTH']  # noqa: E501

        return self.api_client.call_api(
            '/contentConnectors/{connectorId}', '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 get_connectors_list(self, **kwargs):  # noqa: E501
        """Get a list of all Content Connectors for the application   # noqa: E501

        Get list of all Content Connectors in this application.   # 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_connectors_list(async_req=True)
        >>> result = thread.get()

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

    def get_connectors_list_with_http_info(self, **kwargs):  # noqa: E501
        """Get a list of all Content Connectors for the application   # noqa: E501

        Get list of all Content Connectors in this application.   # 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_connectors_list_with_http_info(async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}

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

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # 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 = ['APP_NORMAL', 'OAUTH']  # noqa: E501

        return self.api_client.call_api(
            '/contentConnectors', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectorListSchema',  # 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_connector(self, connector_id, connector, **kwargs):  # noqa: E501
        """update_connector  # noqa: E501

        Update the configuration or enabled flag associated with `connectorId`.   # 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_connector(connector_id, connector, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connector_id: the connector id (required)
        :param UpdateConnectorSchema connector: (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_connector_with_http_info(connector_id, connector, **kwargs)  # noqa: E501
        else:
            (data) = self.update_connector_with_http_info(connector_id, connector, **kwargs)  # noqa: E501
            return data

    def update_connector_with_http_info(self, connector_id, connector, **kwargs):  # noqa: E501
        """update_connector  # noqa: E501

        Update the configuration or enabled flag associated with `connectorId`.   # 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_connector_with_http_info(connector_id, connector, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connector_id: the connector id (required)
        :param UpdateConnectorSchema connector: (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'connector' in params:
            body_params = params['connector']
        # 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 = ['APP_NORMAL', 'OAUTH']  # noqa: E501

        return self.api_client.call_api(
            '/contentConnectors/{connectorId}', '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)
