# coding: utf-8

"""
    Wealthport API

    Wealthport provides a simple, lightweight and open Web API based on the Open API 2.0 standard (<a href=\"https://www.openapis.org\" target=\"_blank\">https://www.openapis.org</a>). Our APIs offer a variety of operations related to managing Sources, Folders, Orders and Recipes. There are operations to submit and track Jobs, upload and download data files and many more.

    OpenAPI spec version: 1.0
    
    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 SourcesApi(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 create_source(self, **kwargs):
        """
        Create Source
        Creates the specified Source.<p>Sources are either uploaded files or a reference to a database. They are referenced in orders to specify which data needs processing.</p><p>Most clients should probably use the Upload File API which implicitly creates a new source on successful file upload.</p>
        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.create_source(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param SourceRequest body: JSON
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.create_source_with_http_info(**kwargs)
        else:
            (data) = self.create_source_with_http_info(**kwargs)
            return data

    def create_source_with_http_info(self, **kwargs):
        """
        Create Source
        Creates the specified Source.<p>Sources are either uploaded files or a reference to a database. They are referenced in orders to specify which data needs processing.</p><p>Most clients should probably use the Upload File API which implicitly creates a new source on successful file upload.</p>
        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.create_source_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param SourceRequest body: JSON
        :return: str
                 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 create_source" % 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 `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources', 'POST',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='str',
                                        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 delete_source(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.delete_source_with_http_info(id, **kwargs)
        else:
            (data) = self.delete_source_with_http_info(id, **kwargs)
            return data

    def delete_source_with_http_info(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 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 delete_source" % 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 `delete_source`")


        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
        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}', 'DELETE',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type=None,
                                        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 get_download_url(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_download_url_with_http_info(id, **kwargs)
        else:
            (data) = self.get_download_url_with_http_info(id, **kwargs)
            return data

    def get_download_url_with_http_info(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 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 get_download_url" % 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 `get_download_url`")


        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(['text/plain'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}/download', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='str',
                                        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 get_upload_url(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_upload_url_with_http_info(name, **kwargs)
        else:
            (data) = self.get_upload_url_with_http_info(name, **kwargs)
            return data

    def get_upload_url_with_http_info(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url_with_http_info(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['name', 'source', 'folder', 'content_type', 'encoding']
        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 get_upload_url" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'name' is set
        if ('name' not in params) or (params['name'] is None):
            raise ValueError("Missing the required parameter `name` when calling `get_upload_url`")


        collection_formats = {}

        path_params = {}

        query_params = []
        if 'name' in params:
            query_params.append(('name', params['name']))
        if 'source' in params:
            query_params.append(('source', params['source']))
        if 'folder' in params:
            query_params.append(('folder', params['folder']))
        if 'content_type' in params:
            query_params.append(('contentType', params['content_type']))
        if 'encoding' in params:
            query_params.append(('encoding', params['encoding']))

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/upload', 'PUT',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='str',
                                        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 retrieve_source(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_source_with_http_info(id, **kwargs)
        else:
            (data) = self.retrieve_source_with_http_info(id, **kwargs)
            return data

    def retrieve_source_with_http_info(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 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 retrieve_source" % 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 `retrieve_source`")


        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 = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='ExistingSource',
                                        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 retrieve_sources(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_sources_with_http_info(**kwargs)
        else:
            (data) = self.retrieve_sources_with_http_info(**kwargs)
            return data

    def retrieve_sources_with_http_info(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []
        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 retrieve_sources" % 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'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='list[ExistingSource]',
                                        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 update_source(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.update_source_with_http_info(id, **kwargs)
        else:
            (data) = self.update_source_with_http_info(id, **kwargs)
            return data

    def update_source_with_http_info(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', '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 update_source" % 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 `update_source`")


        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
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}', 'PUT',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type=None,
                                        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)

35454b219b4d5c2d5772d716165591f3d148ddeb
<mask token>


class SourcesApi(object):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def get_upload_url(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_upload_url_with_http_info(name, **kwargs)
        else:
            data = self.get_upload_url_with_http_info(name, **kwargs)
            return data
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def update_source(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.update_source_with_http_info(id, **kwargs)
        else:
            data = self.update_source_with_http_info(id, **kwargs)
            return data
    <mask token>

<mask token>


class SourcesApi(object):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def delete_source_with_http_info(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 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 delete_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `delete_source`'
                )
        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
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'DELETE',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            None, 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)
    <mask token>

    def get_download_url_with_http_info(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 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 get_download_url"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `get_download_url`'
                )
        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
        header_params['Accept'] = self.api_client.select_header_accept([
            'text/plain'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}/download', 'GET',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            'str', 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 get_upload_url(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_upload_url_with_http_info(name, **kwargs)
        else:
            data = self.get_upload_url_with_http_info(name, **kwargs)
            return data

    def get_upload_url_with_http_info(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url_with_http_info(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = ['name', 'source', 'folder', 'content_type', 'encoding']
        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 get_upload_url"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'name' not in params or params['name'] is None:
            raise ValueError(
                'Missing the required parameter `name` when calling `get_upload_url`'
                )
        collection_formats = {}
        path_params = {}
        query_params = []
        if 'name' in params:
            query_params.append(('name', params['name']))
        if 'source' in params:
            query_params.append(('source', params['source']))
        if 'folder' in params:
            query_params.append(('folder', params['folder']))
        if 'content_type' in params:
            query_params.append(('contentType', params['content_type']))
        if 'encoding' in params:
            query_params.append(('encoding', params['encoding']))
        header_params = {}
        form_params = []
        local_var_files = {}
        body_params = None
        header_params['Accept'] = self.api_client.select_header_accept([
            'text/plain'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/upload', 'PUT',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            'str', 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 retrieve_source(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_source_with_http_info(id, **kwargs)
        else:
            data = self.retrieve_source_with_http_info(id, **kwargs)
            return data

    def retrieve_source_with_http_info(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 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 retrieve_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `retrieve_source`'
                )
        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
        header_params['Accept'] = self.api_client.select_header_accept([
            'application/json'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'GET', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=
            'ExistingSource', 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)
    <mask token>

    def retrieve_sources_with_http_info(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = []
        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 retrieve_sources"
                     % key)
            params[key] = val
        del params['kwargs']
        collection_formats = {}
        path_params = {}
        query_params = []
        header_params = {}
        form_params = []
        local_var_files = {}
        body_params = None
        header_params['Accept'] = self.api_client.select_header_accept([
            'application/json'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources', 'GET', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=
            'list[ExistingSource]', 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 update_source(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.update_source_with_http_info(id, **kwargs)
        else:
            data = self.update_source_with_http_info(id, **kwargs)
            return data

    def update_source_with_http_info(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = ['id', '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 update_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `update_source`'
                )
        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
        if 'body' in params:
            body_params = params['body']
        header_params['Content-Type'
            ] = self.api_client.select_header_content_type(['application/json']
            )
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'PUT', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=None,
            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)

<mask token>


class SourcesApi(object):
    <mask token>
    <mask token>

    def create_source(self, **kwargs):
        """
        Create Source
        Creates the specified Source.<p>Sources are either uploaded files or a reference to a database. They are referenced in orders to specify which data needs processing.</p><p>Most clients should probably use the Upload File API which implicitly creates a new source on successful file upload.</p>
        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.create_source(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param SourceRequest body: JSON
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.create_source_with_http_info(**kwargs)
        else:
            data = self.create_source_with_http_info(**kwargs)
            return data
    <mask token>

    def delete_source(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.delete_source_with_http_info(id, **kwargs)
        else:
            data = self.delete_source_with_http_info(id, **kwargs)
            return data

    def delete_source_with_http_info(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 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 delete_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `delete_source`'
                )
        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
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'DELETE',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            None, 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 get_download_url(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_download_url_with_http_info(id, **kwargs)
        else:
            data = self.get_download_url_with_http_info(id, **kwargs)
            return data

    def get_download_url_with_http_info(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 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 get_download_url"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `get_download_url`'
                )
        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
        header_params['Accept'] = self.api_client.select_header_accept([
            'text/plain'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}/download', 'GET',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            'str', 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 get_upload_url(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_upload_url_with_http_info(name, **kwargs)
        else:
            data = self.get_upload_url_with_http_info(name, **kwargs)
            return data

    def get_upload_url_with_http_info(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url_with_http_info(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = ['name', 'source', 'folder', 'content_type', 'encoding']
        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 get_upload_url"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'name' not in params or params['name'] is None:
            raise ValueError(
                'Missing the required parameter `name` when calling `get_upload_url`'
                )
        collection_formats = {}
        path_params = {}
        query_params = []
        if 'name' in params:
            query_params.append(('name', params['name']))
        if 'source' in params:
            query_params.append(('source', params['source']))
        if 'folder' in params:
            query_params.append(('folder', params['folder']))
        if 'content_type' in params:
            query_params.append(('contentType', params['content_type']))
        if 'encoding' in params:
            query_params.append(('encoding', params['encoding']))
        header_params = {}
        form_params = []
        local_var_files = {}
        body_params = None
        header_params['Accept'] = self.api_client.select_header_accept([
            'text/plain'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/upload', 'PUT',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            'str', 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 retrieve_source(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_source_with_http_info(id, **kwargs)
        else:
            data = self.retrieve_source_with_http_info(id, **kwargs)
            return data

    def retrieve_source_with_http_info(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 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 retrieve_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `retrieve_source`'
                )
        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
        header_params['Accept'] = self.api_client.select_header_accept([
            'application/json'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'GET', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=
            'ExistingSource', 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)
    <mask token>

    def retrieve_sources_with_http_info(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = []
        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 retrieve_sources"
                     % key)
            params[key] = val
        del params['kwargs']
        collection_formats = {}
        path_params = {}
        query_params = []
        header_params = {}
        form_params = []
        local_var_files = {}
        body_params = None
        header_params['Accept'] = self.api_client.select_header_accept([
            'application/json'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources', 'GET', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=
            'list[ExistingSource]', 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 update_source(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.update_source_with_http_info(id, **kwargs)
        else:
            data = self.update_source_with_http_info(id, **kwargs)
            return data

    def update_source_with_http_info(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = ['id', '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 update_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `update_source`'
                )
        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
        if 'body' in params:
            body_params = params['body']
        header_params['Content-Type'
            ] = self.api_client.select_header_content_type(['application/json']
            )
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'PUT', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=None,
            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)

<mask token>
from __future__ import absolute_import
import sys
import os
import re
from six import iteritems
from ..configuration import Configuration
from ..api_client import ApiClient


class SourcesApi(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 create_source(self, **kwargs):
        """
        Create Source
        Creates the specified Source.<p>Sources are either uploaded files or a reference to a database. They are referenced in orders to specify which data needs processing.</p><p>Most clients should probably use the Upload File API which implicitly creates a new source on successful file upload.</p>
        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.create_source(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param SourceRequest body: JSON
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.create_source_with_http_info(**kwargs)
        else:
            data = self.create_source_with_http_info(**kwargs)
            return data

    def create_source_with_http_info(self, **kwargs):
        """
        Create Source
        Creates the specified Source.<p>Sources are either uploaded files or a reference to a database. They are referenced in orders to specify which data needs processing.</p><p>Most clients should probably use the Upload File API which implicitly creates a new source on successful file upload.</p>
        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.create_source_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param SourceRequest body: JSON
        :return: str
                 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 create_source"
                     % 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']
        header_params['Content-Type'
            ] = self.api_client.select_header_content_type(['application/json']
            )
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources', 'POST', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type='str',
            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 delete_source(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.delete_source_with_http_info(id, **kwargs)
        else:
            data = self.delete_source_with_http_info(id, **kwargs)
            return data

    def delete_source_with_http_info(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 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 delete_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `delete_source`'
                )
        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
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'DELETE',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            None, 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 get_download_url(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_download_url_with_http_info(id, **kwargs)
        else:
            data = self.get_download_url_with_http_info(id, **kwargs)
            return data

    def get_download_url_with_http_info(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 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 get_download_url"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `get_download_url`'
                )
        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
        header_params['Accept'] = self.api_client.select_header_accept([
            'text/plain'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}/download', 'GET',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            'str', 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 get_upload_url(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_upload_url_with_http_info(name, **kwargs)
        else:
            data = self.get_upload_url_with_http_info(name, **kwargs)
            return data

    def get_upload_url_with_http_info(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url_with_http_info(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = ['name', 'source', 'folder', 'content_type', 'encoding']
        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 get_upload_url"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'name' not in params or params['name'] is None:
            raise ValueError(
                'Missing the required parameter `name` when calling `get_upload_url`'
                )
        collection_formats = {}
        path_params = {}
        query_params = []
        if 'name' in params:
            query_params.append(('name', params['name']))
        if 'source' in params:
            query_params.append(('source', params['source']))
        if 'folder' in params:
            query_params.append(('folder', params['folder']))
        if 'content_type' in params:
            query_params.append(('contentType', params['content_type']))
        if 'encoding' in params:
            query_params.append(('encoding', params['encoding']))
        header_params = {}
        form_params = []
        local_var_files = {}
        body_params = None
        header_params['Accept'] = self.api_client.select_header_accept([
            'text/plain'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/upload', 'PUT',
            path_params, query_params, header_params, body=body_params,
            post_params=form_params, files=local_var_files, response_type=
            'str', 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 retrieve_source(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_source_with_http_info(id, **kwargs)
        else:
            data = self.retrieve_source_with_http_info(id, **kwargs)
            return data

    def retrieve_source_with_http_info(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 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 retrieve_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `retrieve_source`'
                )
        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
        header_params['Accept'] = self.api_client.select_header_accept([
            'application/json'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'GET', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=
            'ExistingSource', 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 retrieve_sources(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_sources_with_http_info(**kwargs)
        else:
            data = self.retrieve_sources_with_http_info(**kwargs)
            return data

    def retrieve_sources_with_http_info(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = []
        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 retrieve_sources"
                     % key)
            params[key] = val
        del params['kwargs']
        collection_formats = {}
        path_params = {}
        query_params = []
        header_params = {}
        form_params = []
        local_var_files = {}
        body_params = None
        header_params['Accept'] = self.api_client.select_header_accept([
            'application/json'])
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources', 'GET', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=
            'list[ExistingSource]', 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 update_source(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.update_source_with_http_info(id, **kwargs)
        else:
            data = self.update_source_with_http_info(id, **kwargs)
            return data

    def update_source_with_http_info(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        all_params = ['id', '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 update_source"
                     % key)
            params[key] = val
        del params['kwargs']
        if 'id' not in params or params['id'] is None:
            raise ValueError(
                'Missing the required parameter `id` when calling `update_source`'
                )
        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
        if 'body' in params:
            body_params = params['body']
        header_params['Content-Type'
            ] = self.api_client.select_header_content_type(['application/json']
            )
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']
        return self.api_client.call_api('/sources/{id}', 'PUT', path_params,
            query_params, header_params, body=body_params, post_params=
            form_params, files=local_var_files, response_type=None,
            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)

# coding: utf-8

"""
    Wealthport API

    Wealthport provides a simple, lightweight and open Web API based on the Open API 2.0 standard (<a href=\"https://www.openapis.org\" target=\"_blank\">https://www.openapis.org</a>). Our APIs offer a variety of operations related to managing Sources, Folders, Orders and Recipes. There are operations to submit and track Jobs, upload and download data files and many more.

    OpenAPI spec version: 1.0
    
    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 SourcesApi(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 create_source(self, **kwargs):
        """
        Create Source
        Creates the specified Source.<p>Sources are either uploaded files or a reference to a database. They are referenced in orders to specify which data needs processing.</p><p>Most clients should probably use the Upload File API which implicitly creates a new source on successful file upload.</p>
        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.create_source(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param SourceRequest body: JSON
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.create_source_with_http_info(**kwargs)
        else:
            (data) = self.create_source_with_http_info(**kwargs)
            return data

    def create_source_with_http_info(self, **kwargs):
        """
        Create Source
        Creates the specified Source.<p>Sources are either uploaded files or a reference to a database. They are referenced in orders to specify which data needs processing.</p><p>Most clients should probably use the Upload File API which implicitly creates a new source on successful file upload.</p>
        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.create_source_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param SourceRequest body: JSON
        :return: str
                 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 create_source" % 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 `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources', 'POST',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='str',
                                        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 delete_source(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.delete_source_with_http_info(id, **kwargs)
        else:
            (data) = self.delete_source_with_http_info(id, **kwargs)
            return data

    def delete_source_with_http_info(self, id, **kwargs):
        """
        Delete Source
        Deletes the specified Source.
        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.delete_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the Source to delete (required)
        :return: None
                 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 delete_source" % 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 `delete_source`")


        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
        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}', 'DELETE',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type=None,
                                        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 get_download_url(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_download_url_with_http_info(id, **kwargs)
        else:
            (data) = self.get_download_url_with_http_info(id, **kwargs)
            return data

    def get_download_url_with_http_info(self, id, **kwargs):
        """
        Download File
        Initiates a file download and returns the URL where to download the file from.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be downloaded from. The URL is available in the <pre>Location</pre> HTTP header of the response. The time restriction of the URL is availablein the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP GET</pre> request on the URL to download the file.</p>
        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.get_download_url_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of file to download (required)
        :return: str
                 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 get_download_url" % 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 `get_download_url`")


        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(['text/plain'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}/download', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='str',
                                        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 get_upload_url(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_upload_url_with_http_info(name, **kwargs)
        else:
            (data) = self.get_upload_url_with_http_info(name, **kwargs)
            return data

    def get_upload_url_with_http_info(self, name, **kwargs):
        """
        Upload File
        Initiates a file upload and returns the URL where to upload the file to.<p>Calling this API generates a secure, unique and time-restricted URL where the file can be uploaded to. The URL is available in the <pre>Location</pre> HTTP header of the response. The temporal validity of the URL is available in the <pre>Cache-Control</pre> HTTP header of the response.Clients may perform a <pre>HTTP PUT</pre> request on the URL to upload the file using a form where a file <pre>sample.csv</pre> is passed as property <pre>file=sample.csv</pre>. For security reasons, clients must pass all HTTP headers as returned by the <pre>X-WP-Upload-Headers</pre> in the response, together with their values. This procedure ensures a secure, encrypted file upload.</p><p>Note that calling this API automatically generates a Source, there is no need to call the Create Source API.</p>
        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.get_upload_url_with_http_info(name, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str name: Name of the source to create. The name must correspond to the exact file name of the file being uploaded. (required)
        :param str source: Existing source ID to create a new version from
        :param str folder: Folder ID where to upload source to
        :param str content_type: MIME type of the source file
        :param str encoding: Encoding of the source file
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['name', 'source', 'folder', 'content_type', 'encoding']
        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 get_upload_url" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'name' is set
        if ('name' not in params) or (params['name'] is None):
            raise ValueError("Missing the required parameter `name` when calling `get_upload_url`")


        collection_formats = {}

        path_params = {}

        query_params = []
        if 'name' in params:
            query_params.append(('name', params['name']))
        if 'source' in params:
            query_params.append(('source', params['source']))
        if 'folder' in params:
            query_params.append(('folder', params['folder']))
        if 'content_type' in params:
            query_params.append(('contentType', params['content_type']))
        if 'encoding' in params:
            query_params.append(('encoding', params['encoding']))

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/upload', 'PUT',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='str',
                                        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 retrieve_source(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_source_with_http_info(id, **kwargs)
        else:
            (data) = self.retrieve_source_with_http_info(id, **kwargs)
            return data

    def retrieve_source_with_http_info(self, id, **kwargs):
        """
        Retrieve Source
        Retrieves the specified Source.
        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.retrieve_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of the source to retrieve (required)
        :return: ExistingSource
                 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 retrieve_source" % 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 `retrieve_source`")


        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 = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='ExistingSource',
                                        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 retrieve_sources(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.retrieve_sources_with_http_info(**kwargs)
        else:
            (data) = self.retrieve_sources_with_http_info(**kwargs)
            return data

    def retrieve_sources_with_http_info(self, **kwargs):
        """
        Retrieve Sources
        Retrieves all Sources stored in the Data Inventory.
        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.retrieve_sources_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :return: list[ExistingSource]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []
        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 retrieve_sources" % 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'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources', 'GET',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type='list[ExistingSource]',
                                        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 update_source(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.update_source_with_http_info(id, **kwargs)
        else:
            (data) = self.update_source_with_http_info(id, **kwargs)
            return data

    def update_source_with_http_info(self, id, **kwargs):
        """
        Update Source
        Updates the specified Source.
        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.update_source_with_http_info(id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str id: Source ID of Source to update (required)
        :param SourceRequest body: JSON
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', '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 update_source" % 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 `update_source`")


        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
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = ['Using HTTP Header', 'Using URL Query Parameter']

        return self.api_client.call_api('/sources/{id}', 'PUT',
                                        path_params,
                                        query_params,
                                        header_params,
                                        body=body_params,
                                        post_params=form_params,
                                        files=local_var_files,
                                        response_type=None,
                                        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)
