# coding: utf-8

"""
    Salt Edge Account Information API

    API Reference for services  # noqa: E501

    OpenAPI spec version: 5.0.0
    Contact: support@saltedge.com
    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 swagger_client.api_client import ApiClient


class ConnectionsApi(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 connections_connection_id_delete(self, connection_id, **kwargs):  # noqa: E501
        """Remove a connection  # noqa: E501

        Removes a connection from our system and revokes the consent. All the associated accounts and transactions to that connection will be destroyed as well. Salt Edge will send a [destroy](#destroy) callback to your web application. Make sure to specify the `Destroy URL` in your client account by accessing <a href='https://www.saltedge.com/clients/callbacks/edit' target=\"_blank\">callbacks page</a>.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_delete(connection_id, async_req=True)
        >>> result = thread.get()

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

    def connections_connection_id_delete_with_http_info(self, connection_id, **kwargs):  # noqa: E501
        """Remove a connection  # noqa: E501

        Removes a connection from our system and revokes the consent. All the associated accounts and transactions to that connection will be destroyed as well. Salt Edge will send a [destroy](#destroy) callback to your web application. Make sure to specify the `Destroy URL` in your client account by accessing <a href='https://www.saltedge.com/clients/callbacks/edit' target=\"_blank\">callbacks page</a>.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_delete_with_http_info(connection_id, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'connection_id' in params:
            path_params['connection_id'] = params['connection_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

        # Authentication setting
        auth_settings = ['app_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections/{connection_id}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RemovedConnectionResponse',  # 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 connections_connection_id_get(self, connection_id, **kwargs):  # noqa: E501
        """Show a connection  # noqa: E501

        Returns a single connection object.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_get(connection_id, async_req=True)
        >>> result = thread.get()

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

    def connections_connection_id_get_with_http_info(self, connection_id, **kwargs):  # noqa: E501
        """Show a connection  # noqa: E501

        Returns a single connection object.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_get_with_http_info(connection_id, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'connection_id' in params:
            path_params['connection_id'] = params['connection_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

        # Authentication setting
        auth_settings = ['app_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections/{connection_id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectionResponse',  # 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 connections_connection_id_interactive_put(self, connection_id, **kwargs):  # noqa: E501
        """Interactive step  # noqa: E501

        If the currently fetching connection requires any interactive credentials for fetching, Salt Edge will send the [Interactive callback](#interactive). Make sure to specify the `Interactive URL` in your client account by accessing <a href='https://www.saltedge.com/clients/callbacks/edit' target=\"_blank\">callbacks page</a>.  Upon receiving the interactive callback, your app should ask the user for the interactive credentials and send them to the `/interactive` route for the connection. After that, the fetching process will continue as usual.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_interactive_put(connection_id, async_req=True)
        >>> result = thread.get()

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

    def connections_connection_id_interactive_put_with_http_info(self, connection_id, **kwargs):  # noqa: E501
        """Interactive step  # noqa: E501

        If the currently fetching connection requires any interactive credentials for fetching, Salt Edge will send the [Interactive callback](#interactive). Make sure to specify the `Interactive URL` in your client account by accessing <a href='https://www.saltedge.com/clients/callbacks/edit' target=\"_blank\">callbacks page</a>.  Upon receiving the interactive callback, your app should ask the user for the interactive credentials and send them to the `/interactive` route for the connection. After that, the fetching process will continue as usual.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_interactive_put_with_http_info(connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connection_id: (required)
        :param InteractiveConnectionRequestBody body:
        :return: ConnectionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        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'])  # 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_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections/{connection_id}/interactive', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectionResponse',  # 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 connections_connection_id_put(self, connection_id, **kwargs):  # noqa: E501
        """Update connection  # noqa: E501

        Update `status`, `store_credentials` or `daily_refresh` of a connection.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_put(connection_id, async_req=True)
        >>> result = thread.get()

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

    def connections_connection_id_put_with_http_info(self, connection_id, **kwargs):  # noqa: E501
        """Update connection  # noqa: E501

        Update `status`, `store_credentials` or `daily_refresh` of a connection.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_put_with_http_info(connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connection_id: (required)
        :param UpdateConnectionRequestBody body:
        :return: ConnectionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        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'])  # 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_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections/{connection_id}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectionResponse',  # 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 connections_connection_id_reconnect_put(self, connection_id, **kwargs):  # noqa: E501
        """Reconnect a connection  # noqa: E501

        In order to [reconnect](#connections-reconnect) a connection, your app needs to send the credentials object, connection's `id`, [consent object](#consents-object) and/or [attempt object](#attempts-object). This means that the consent confirmation should be handled on the client's side, and the 'access terms' the customer agreed on should be passed.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_reconnect_put(connection_id, async_req=True)
        >>> result = thread.get()

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

    def connections_connection_id_reconnect_put_with_http_info(self, connection_id, **kwargs):  # noqa: E501
        """Reconnect a connection  # noqa: E501

        In order to [reconnect](#connections-reconnect) a connection, your app needs to send the credentials object, connection's `id`, [consent object](#consents-object) and/or [attempt object](#attempts-object). This means that the consent confirmation should be handled on the client's side, and the 'access terms' the customer agreed on should be passed.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_reconnect_put_with_http_info(connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connection_id: (required)
        :param ReconnectConnectionRequestBody body:
        :return: ConnectionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        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'])  # 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_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections/{connection_id}/reconnect', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectionResponse',  # 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 connections_connection_id_refresh_put(self, connection_id, **kwargs):  # noqa: E501
        """Refresh a connection  # noqa: E501

        Allows you to trigger a refetch of the data associated with a specific connection. Note that you can refresh a connection only if it has an active [consent](#consents). If the response is successful, it will contain the `next_refresh_possible_at` value, and you can expect the [usual callbacks](#callbacks) of the fetching workflow.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_refresh_put(connection_id, async_req=True)
        >>> result = thread.get()

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

    def connections_connection_id_refresh_put_with_http_info(self, connection_id, **kwargs):  # noqa: E501
        """Refresh a connection  # noqa: E501

        Allows you to trigger a refetch of the data associated with a specific connection. Note that you can refresh a connection only if it has an active [consent](#consents). If the response is successful, it will contain the `next_refresh_possible_at` value, and you can expect the [usual callbacks](#callbacks) of the fetching workflow.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_connection_id_refresh_put_with_http_info(connection_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str connection_id: (required)
        :param RefreshConnectionRequestBody body:
        :return: ConnectionResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        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'])  # 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_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections/{connection_id}/refresh', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectionResponse',  # 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 connections_get(self, customer_id, **kwargs):  # noqa: E501
        """List of connections  # noqa: E501

        Returns all the connections accessible to your application for a certain customer. The connections are sorted in ascending order of their `id`, so the newest connections will come last. We recommend you fetch the whole list of connections to check whether any of the properties have changed.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_get(customer_id, async_req=True)
        >>> result = thread.get()

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

    def connections_get_with_http_info(self, customer_id, **kwargs):  # noqa: E501
        """List of connections  # noqa: E501

        Returns all the connections accessible to your application for a certain customer. The connections are sorted in ascending order of their `id`, so the newest connections will come last. We recommend you fetch the whole list of connections to check whether any of the properties have changed.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_get_with_http_info(customer_id, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'customer_id' in params:
            query_params.append(('customer_id', params['customer_id']))  # noqa: E501
        if 'from_id' in params:
            query_params.append(('from_id', params['from_id']))  # 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

        # Authentication setting
        auth_settings = ['app_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectionsResponse',  # 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 connections_post(self, **kwargs):  # noqa: E501
        """Create a connection  # noqa: E501

        When not using [Salt Edge Connect](#salt_edge_connect), your app will have to pass the user's values of provider's [fields](#providers-fields) within the payload.  The credentials object should be modeled after the provider's fields.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_post(async_req=True)
        >>> result = thread.get()

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

    def connections_post_with_http_info(self, **kwargs):  # noqa: E501
        """Create a connection  # noqa: E501

        When not using [Salt Edge Connect](#salt_edge_connect), your app will have to pass the user's values of provider's [fields](#providers-fields) within the payload.  The credentials object should be modeled after the provider's fields.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.connections_post_with_http_info(async_req=True)
        >>> result = thread.get()

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

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

        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'])  # 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_id', 'secret']  # noqa: E501

        return self.api_client.call_api(
            '/connections', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ConnectionResponse',  # 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)
