#!/usr/bin/env python
"""
PetApi.py
Copyright 2015 Reverb Technologies, 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 PetApi(object):

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

    
    
    def updatePet(self, **kwargs):
        """Update an existing pet

        Args:
            
            body, Pet: Pet object that needs to be added to the store (required)
            
            
        
        Returns: 
        """

        allParams = ['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 updatePet" % key)
            params[key] = val
        del params['kwargs']

        resourcePath = '/pet'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'PUT'

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = 'application/json,application/xml';

        

        

        

        

        
        if ('body' in params):
            bodyParam = params['body']
        

        postData = (formParams if formParams else bodyParam)

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

        
        
        
    
    def addPet(self, **kwargs):
        """Add a new pet to the store

        Args:
            
            body, Pet: Pet object that needs to be added to the store (required)
            
            
        
        Returns: 
        """

        allParams = ['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 addPet" % key)
            params[key] = val
        del params['kwargs']

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

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = 'application/json,application/xml';

        

        

        

        

        
        if ('body' in params):
            bodyParam = params['body']
        

        postData = (formParams if formParams else bodyParam)

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

        
        
        
    
    def findPetsByStatus(self, **kwargs):
        """Finds Pets by status

        Args:
            
            status, list[str]: Status values that need to be considered for filter (required)
            
            
        
        Returns: list[Pet]
        """

        allParams = ['status']

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

        resourcePath = '/pet/findByStatus'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = '';

        
        if ('status' in params):
            queryParams['status'] = self.apiClient.toPathValue(params['status'])
        

        

        

        

        

        postData = (formParams if formParams else bodyParam)

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

        
        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'list[Pet]')
        return responseObject
        
        
        
    
    def findPetsByTags(self, **kwargs):
        """Finds Pets by tags

        Args:
            
            tags, list[str]: Tags to filter by (required)
            
            
        
        Returns: list[Pet]
        """

        allParams = ['tags']

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

        resourcePath = '/pet/findByTags'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = '';

        
        if ('tags' in params):
            queryParams['tags'] = self.apiClient.toPathValue(params['tags'])
        

        

        

        

        

        postData = (formParams if formParams else bodyParam)

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

        
        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'list[Pet]')
        return responseObject
        
        
        
    
    def getPetById(self, **kwargs):
        """Find pet by ID

        Args:
            
            petId, long: ID of pet that needs to be fetched (required)
            
            
        
        Returns: Pet
        """

        allParams = ['petId']

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

        resourcePath = '/pet/{petId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'GET'

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = '';

        

        

        
        if ('petId' in params):
            replacement = str(self.apiClient.toPathValue(params['petId']))
            resourcePath = resourcePath.replace('{' + 'petId' + '}',
                                                replacement)
        

        

        

        postData = (formParams if formParams else bodyParam)

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

        
        if not response:
            return None

        responseObject = self.apiClient.deserialize(response, 'Pet')
        return responseObject
        
        
        
    
    def updatePetWithForm(self, **kwargs):
        """Updates a pet in the store with form data

        Args:
            
            petId, str: ID of pet that needs to be updated (required)
            
            
            name, str: Updated name of the pet (required)
            
            
            status, str: Updated status of the pet (required)
            
            
        
        Returns: 
        """

        allParams = ['petId', 'name', 'status']

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

        resourcePath = '/pet/{petId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'POST'

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = 'application/x-www-form-urlencoded';

        

        

        
        if ('petId' in params):
            replacement = str(self.apiClient.toPathValue(params['petId']))
            resourcePath = resourcePath.replace('{' + 'petId' + '}',
                                                replacement)
        

        
        if ('name' in params):
            formParams['name'] = params['name']
        
        if ('status' in params):
            formParams['status'] = params['status']
        

        

        postData = (formParams if formParams else bodyParam)

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

        
        
        
    
    def deletePet(self, **kwargs):
        """Deletes a pet

        Args:
            
            api_key, str:  (required)
            
            
            petId, long: Pet id to delete (required)
            
            
        
        Returns: 
        """

        allParams = ['api_key', 'petId']

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

        resourcePath = '/pet/{petId}'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'DELETE'

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = '';

        

        
        if ('api_key' in params):
            headerParams['api_key'] = params['api_key']
        

        
        if ('petId' in params):
            replacement = str(self.apiClient.toPathValue(params['petId']))
            resourcePath = resourcePath.replace('{' + 'petId' + '}',
                                                replacement)
        

        

        

        postData = (formParams if formParams else bodyParam)

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

        
        
        
    
    def uploadFile(self, **kwargs):
        """uploads an image

        Args:
            
            additionalMetadata, str: Additional data to pass to server (required)
            
            
            file, file: file to upload (required)
            
            
        
        Returns: 
        """

        allParams = ['additionalMetadata', 'file']

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

        resourcePath = '/pet/{petId}/uploadImage'
        resourcePath = resourcePath.replace('{format}', 'json')
        method = 'POST'

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

        headerParams['Accept'] = 'application/json,application/xml';
        headerParams['Content-Type'] = 'multipart/form-data';

        

        

        

        
        if ('additionalMetadata' in params):
            formParams['additionalMetadata'] = params['additionalMetadata']
        
        if ('file' in params):
            files['file'] = params['file']
        

        

        postData = (formParams if formParams else bodyParam)

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

        
        
        
    


