#!/usr/bin/env python
"""
$resource$.py
Copyright 2011 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

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
import model

class $resource$(object):

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

$methods:{ method |
    def $method.name$(self, $method.arguments: { argument | $if(argument.required)$$argument.name$, $endif$}$$method.arguments: { argument | $if(! argument.required)$$argument.name$=None, $endif$}$):
        """$method.title$
    $if(method.description)$
        $method.description$
    $endif$
        Args:
            $method.arguments:{ argument |$argument.name$ -- $argument.description$
       $if(argument.allowedValues)$
        Allowed values are - $argument.allowedValues$
       $endif$}$
    $if(!method.responseVoid)$
        Return:
            $method.returnValue$ -- an instance of $method.returnClassName$
    $endif$"""

        # Parse inputs
        resourcePath = '$method.resourcePath$'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = '$method.methodType$'

        queryParams = {}
        headerParams = {}
$if(method.authToken)$
        if not authToken:
            raise Exception('missing authToken')
        headerParams['auth_token'] = authToken
$endif$

$if(!method.inputModel)$
$method.queryParameters:{ argument |
        queryParams['$argument.name$'] = $argument.name$
}$  

$method.pathParameters:{ argument |
        if $argument.name$ != None:
            resourcePath = resourcePath.replace('{$argument.name$}', $argument.name$)

}$
$endif$
$if(method.inputModel)$
$method.queryParameters:{ argument |
        if $argument.inputModelClassArgument$ != None and $argument.inputModelClassArgument$.$argument.name$ != None:
             queryParams['$argument.name$'] = $argument.inputModelClassArgument$.$argument.name$

}$
$method.pathParameters:{ argument |
        if $argument.inputModelClassArgument$ != None and $argument.inputModelClassArgument$.$argument.name$ != None:
             resourcePath = resourcePath.replace('{$argument.name$}', $argument.inputModelClassArgument$.$argument.name$)
}$
$endif$

        # Make the API Call
$if(method.postObject)$
        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)
$endif$

$if(!method.postObject)$
        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          None, headerParams)
$endif$

$if(!method.responseVoid)$
        if not response:
            return None

    $if(!method.returnValueList)$
        # Create output objects if the response has more than one object
        responseObject = self.apiClient.deserialize(response,
                                                    model.$method.returnClassName$.$method.returnClassName$)
        return responseObject
    $endif$

    $if(method.returnValueList)$
        responseObjects = []
        for responseObject in response:
          responseObjects.append(self.apiClient.deserialize(responseObject,
                                                         model.$method.returnClassName$.$method.returnClassName$))
        return responseObjects
    $endif$
$endif$

}$


1d3be3cf8dfda1e173c9f78d40c537470273ef38
#!/usr/bin/env python
"""
$resource$.py
Copyright 2011 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

sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
import model

class $resource$(object):

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

$methods:{ method |
    def $method.name$(self, $method.arguments: { argument | $if(argument.required)$$argument.name$, $endif$}$$method.arguments: { argument | $if(! argument.required)$$argument.name$=None, $endif$}$):
        """$method.title$
    $if(method.description)$
        $method.description$
    $endif$
        Args:
            $method.arguments:{ argument |$argument.name$ -- $argument.description$
       $if(argument.allowedValues)$
        Allowed values are - $argument.allowedValues$
       $endif$}$
    $if(!method.responseVoid)$
        Return:
            $method.returnValue$ -- an instance of $method.returnClassName$
    $endif$"""

        # Parse inputs
        resourcePath = '$method.resourcePath$'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = '$method.methodType$'

        queryParams = {}
        headerParams = {}
$if(method.authToken)$
        if not authToken:
            raise Exception('missing authToken')
        headerParams['auth_token'] = authToken
$endif$

$if(!method.inputModel)$
$method.queryParameters:{ argument |
        queryParams['$argument.name$'] = $argument.name$
}$  

$method.pathParameters:{ argument |
        if $argument.name$ != None:
            resourcePath = resourcePath.replace('{$argument.name$}', $argument.name$)

}$
$endif$
$if(method.inputModel)$
$method.queryParameters:{ argument |
        if $argument.inputModelClassArgument$ != None and $argument.inputModelClassArgument$.$argument.name$ != None:
             queryParams['$argument.name$'] = $argument.inputModelClassArgument$.$argument.name$

}$
$method.pathParameters:{ argument |
        if $argument.inputModelClassArgument$ != None and $argument.inputModelClassArgument$.$argument.name$ != None:
             resourcePath = resourcePath.replace('{$argument.name$}', $argument.inputModelClassArgument$.$argument.name$)
}$
$endif$

        # Make the API Call
$if(method.postObject)$
        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          postData, headerParams)
$endif$

$if(!method.postObject)$
        response = self.apiClient.callAPI(resourcePath, method, queryParams,
                                          None, headerParams)
$endif$

$if(!method.responseVoid)$
        if not response:
            return None

    $if(!method.returnValueList)$
        # Create output objects if the response has more than one object
        responseObject = self.apiClient.deserialize(response,
                                                    model.$method.returnClassName$.$method.returnClassName$)
        return responseObject
    $endif$

    $if(method.returnValueList)$
        responseObjects = []
        for responseObject in response:
          responseObjects.append(self.apiClient.deserialize(responseObject,
                                                         model.$method.returnClassName$.$method.returnClassName$))
        return responseObjects
    $endif$
$endif$

}$

