#!/usr/bin/env python
"""
WordAPI.py
Copyright 2014 Wordnik, Inc.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
"""
import sys
import os

from models import *


class V1Api(object):

    def __init__(self, apiClient):
      self.apiClient = apiClient

    

    def putAccount(self, body, **kwargs):
        """Update account

        Args:
            ticket, str: Session ticket (optional)

            password, str: Current password (optional)

            body, Account: Account object (required)

            

        Returns: 
        """

        allParams = ['ticket', 'password', 'body']

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

        resourcePath = '/v1/accounts/me'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'PUT'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('password' in params):
            queryParams['password'] = self.apiClient.toPathValue(params['password'])
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        if ('' in params):
            bodyParam = params['']
        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        

        

    def getAccount(self, **kwargs):
        """Get account

        Args:
            ticket, str: Session ticket (optional)

            

        Returns: Account
        """

        allParams = ['ticket']

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

        resourcePath = '/v1/accounts/me'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Account')
        return responseObject
        

        

    def createConnectionDirect(self, body, **kwargs):
        """Create a source connection

        Args:
            fetch, str: fetch (optional)

            ticket, str: Session ticket (optional)

            body, Connection: Connection object (required)

            

        Returns: Connection
        """

        allParams = ['fetch', 'ticket', 'body']

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

        resourcePath = '/v1/connections'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'POST'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('fetch' in params):
            queryParams['fetch'] = self.apiClient.toPathValue(params['fetch'])
        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        if ('' in params):
            bodyParam = params['']
        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Connection')
        return responseObject
        

        

    def getConnectionsDirect(self, **kwargs):
        """Get all source connections

        Args:
            ticket, str: Session ticket (optional)

            

        Returns: Connection
        """

        allParams = ['ticket']

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

        resourcePath = '/v1/connections'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Connection')
        return responseObject
        

        

    def deleteConnectionDirect(self, connectionId, **kwargs):
        """Delete source connection

        Args:
            connectionId, str: Source Connection Id (required)

            ticket, str: Session ticket (optional)

            

        Returns: 
        """

        allParams = ['connectionId', 'ticket']

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

        resourcePath = '/v1/connections/{connectionId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'DELETE'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('connectionId' in params):
            replacement = str(self.apiClient.toPathValue(params['connectionId']))
            resourcePath = resourcePath.replace('{' + 'connectionId' + '}',
                                                replacement)
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        

        

    def getConnectionDirect(self, connectionId, **kwargs):
        """Get source connection

        Args:
            connectionId, str: Source Connection Id (required)

            ticket, str: Session ticket (optional)

            

        Returns: Connection
        """

        allParams = ['connectionId', 'ticket']

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

        resourcePath = '/v1/connections/{connectionId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('connectionId' in params):
            replacement = str(self.apiClient.toPathValue(params['connectionId']))
            resourcePath = resourcePath.replace('{' + 'connectionId' + '}',
                                                replacement)
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Connection')
        return responseObject
        

        

    def putConnectionCredentialsDirect(self, connectionId, body, **kwargs):
        """Update credentials in source connection

        Args:
            connectionId, str: Source Connection Id (required)

            ticket, str: Session ticket (optional)

            body, Credentials: Credentials (required)

            

        Returns: 
        """

        allParams = ['connectionId', 'ticket', 'body']

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

        resourcePath = '/v1/connections/{connectionId}/credentials'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'PUT'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('connectionId' in params):
            replacement = str(self.apiClient.toPathValue(params['connectionId']))
            resourcePath = resourcePath.replace('{' + 'connectionId' + '}',
                                                replacement)
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        if ('' in params):
            bodyParam = params['']
        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        

        

    def fetchDirect(self, connectionId, **kwargs):
        """Initiate a fetch for source connection

        Args:
            connectionId, str: Source Connection Id (required)

            all, str: All (optional)

            ticket, str: Session ticket (optional)

            

        Returns: 
        """

        allParams = ['connectionId', 'all', 'ticket']

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

        resourcePath = '/v1/connections/{connectionId}/fetch'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'POST'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('all' in params):
            queryParams['all'] = self.apiClient.toPathValue(params['all'])
        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('connectionId' in params):
            replacement = str(self.apiClient.toPathValue(params['connectionId']))
            resourcePath = resourcePath.replace('{' + 'connectionId' + '}',
                                                replacement)
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        

        

    def getDestinations(self, **kwargs):
        """Get all destinations

        Args:
            filtering, str: Pro-Service filter (optional)

            ticket, str: Session ticket (optional)

            

        Returns: Destination
        """

        allParams = ['filtering', 'ticket']

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

        resourcePath = '/v1/destinations'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('filtering' in params):
            queryParams['filtering'] = self.apiClient.toPathValue(params['filtering'])
        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Destination')
        return responseObject
        

        

    def getDocumentsDirect(self, **kwargs):
        """Get all documents

        Args:
            sortProperty, str: Sort property (optional)

            sortDirection, str: Sort direction (optional)

            ticket, str: Session ticket (optional)

            

        Returns: Document
        """

        allParams = ['sortProperty', 'sortDirection', 'ticket']

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

        resourcePath = '/v1/documents'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('sortProperty' in params):
            queryParams['sortProperty'] = self.apiClient.toPathValue(params['sortProperty'])
        if ('sortDirection' in params):
            queryParams['sortDirection'] = self.apiClient.toPathValue(params['sortDirection'])
        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Document')
        return responseObject
        

        

    def getDocumentDirect(self, documentId, **kwargs):
        """Get document

        Args:
            documentId, str: Document Id (required)

            ticket, str: Session ticket (optional)

            

        Returns: Document
        """

        allParams = ['documentId', 'ticket']

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

        resourcePath = '/v1/documents/{documentId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('documentId' in params):
            replacement = str(self.apiClient.toPathValue(params['documentId']))
            resourcePath = resourcePath.replace('{' + 'documentId' + '}',
                                                replacement)
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Document')
        return responseObject
        

        

    def deleteDocumentDirect(self, documentId, **kwargs):
        """Delete document

        Args:
            documentId, str: Document Id (required)

            ticket, str: Session ticket (optional)

            

        Returns: 
        """

        allParams = ['documentId', 'ticket']

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

        resourcePath = '/v1/documents/{documentId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'DELETE'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('documentId' in params):
            replacement = str(self.apiClient.toPathValue(params['documentId']))
            resourcePath = resourcePath.replace('{' + 'documentId' + '}',
                                                replacement)
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        

        

    def putDocument(self, documentId, body, **kwargs):
        """Update account

        Args:
            documentId, str: Document Id (required)

            ticket, str: Session ticket (optional)

            body, Document: Document object (required)

            

        Returns: 
        """

        allParams = ['documentId', 'ticket', 'body']

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

        resourcePath = '/v1/documents/{documentId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'PUT'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if ('documentId' in params):
            replacement = str(self.apiClient.toPathValue(params['documentId']))
            resourcePath = resourcePath.replace('{' + 'documentId' + '}',
                                                replacement)
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        if ('' in params):
            bodyParam = params['']
        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        

        

    def getSources(self, **kwargs):
        """Get all sources

        Args:
            ticket, str: Session ticket (optional)

            

        Returns: Institution
        """

        allParams = ['ticket']

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

        resourcePath = '/v1/sources'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

        queryParams = {}
        headerParams = {}
        formParams = {}
        bodyParam = None

        if ('ticket' in params):
            queryParams['ticket'] = self.apiClient.toPathValue(params['ticket'])
        if formParams:
            headerParams['Content-type'] = 'application/x-www-form-urlencoded'

        postData = (formParams if formParams else bodyParam)

        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)

        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Institution')
        return responseObject
        

        

    




