    {-
       Swagger Petstore

       This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\

       OpenAPI spec version: 2.0
       Swagger Petstore API version: 1.0.0
       Contact: apiteam@swagger.io
       Generated by Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
    -}

    {-|
    Module : SwaggerPetstore.API.Pet
    -}

    {-# LANGUAGE FlexibleContexts #-}
    {-# LANGUAGE FlexibleInstances #-}
    {-# LANGUAGE MonoLocalBinds #-}
    {-# LANGUAGE MultiParamTypeClasses #-}
    {-# LANGUAGE OverloadedStrings #-}
    {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}

    module SwaggerPetstore.API.Pet where

    import SwaggerPetstore.Core
    import SwaggerPetstore.MimeTypes
    import SwaggerPetstore.Model as M

    import qualified Data.Aeson as A
    import qualified Data.ByteString as B
    import qualified Data.ByteString.Lazy as BL
    import qualified Data.Data as P (Typeable, TypeRep, typeOf, typeRep)
    import qualified Data.Foldable as P
    import qualified Data.Map as Map
    import qualified Data.Maybe as P
    import qualified Data.Proxy as P (Proxy(..))
    import qualified Data.Set as Set
    import qualified Data.String as P
    import qualified Data.Text as T
    import qualified Data.Text.Encoding as T
    import qualified Data.Text.Lazy as TL
    import qualified Data.Text.Lazy.Encoding as TL
    import qualified Data.Time as TI
    import qualified Network.HTTP.Client.MultipartFormData as NH
    import qualified Network.HTTP.Media as ME
    import qualified Network.HTTP.Types as NH
    import qualified Web.FormUrlEncoded as WH
    import qualified Web.HttpApiData as WH

    import Data.Text (Text)
    import GHC.Base ((<|>))

    import Prelude ((==),(/=),($), (.),(<$>),(<*>),(>>=),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)
    import qualified Prelude as P

    -- * Operations

    -- ** Pet

    -- *** addPet

    -- | @POST \/pet@
    --
    -- Add a new pet to the store
    --
    --
    --
    -- AuthMethod: 'AuthOAuthPetstoreAuth'
    --
    -- Note: Has 'Produces' instances, but no response schema
    --
    addPet
      :: (Consumes AddPet contentType, MimeRender contentType Pet)
      => ContentType contentType -- ^ request content-type ('MimeType')
      -> Accept accept -- ^ request accept ('MimeType')
      -> Pet -- ^ "body" -  Pet object that needs to be added to the store
      -> SwaggerPetstoreRequest AddPet contentType res accept
    addPet _  _ body =
      _mkRequest "POST" ["/pet"]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
        `setBodyParam` body

    data AddPet

    -- | /Body Param/ "body" - Pet object that needs to be added to the store
    instance HasBodyParam AddPet Pet

    -- | @application/json@
    instance Consumes AddPet MimeJSON
    -- | @application/xml@
    instance Consumes AddPet MimeXML

    -- | @application/xml@
    instance Produces AddPet MimeXML
    -- | @application/json@
    instance Produces AddPet MimeJSON

    -- *** deletePet

    -- | @DELETE \/pet\/{petId}@
    --
    -- Deletes a pet
    --
    --
    --
    -- AuthMethod: 'AuthOAuthPetstoreAuth'
    --
    -- Note: Has 'Produces' instances, but no response schema
    --
    deletePet
      :: Accept accept -- ^ request accept ('MimeType')
      -> PetId -- ^ "petId" -  Pet id to delete
      -> SwaggerPetstoreRequest DeletePet MimeNoContent res accept
    deletePet  _ (PetId petId) =
      _mkRequest "DELETE" ["/pet/",toPath petId]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)

    data DeletePet
    instance HasOptionalParam DeletePet ApiKey where
      applyOptionalParam req (ApiKey xs) =
        req `setHeader` toHeader ("api_key", xs)
    -- | @application/xml@
    instance Produces DeletePet MimeXML
    -- | @application/json@
    instance Produces DeletePet MimeJSON

    -- *** findPetsByStatus

    -- | @GET \/pet\/findByStatus@
    --
    -- Finds Pets by status
    --
    -- Multiple status values can be provided with comma separated strings
    --
    -- AuthMethod: 'AuthOAuthPetstoreAuth'
    --
    findPetsByStatus
      :: Accept accept -- ^ request accept ('MimeType')
      -> Status -- ^ "status" -  Status values that need to be considered for filter
      -> SwaggerPetstoreRequest FindPetsByStatus MimeNoContent [Pet] accept
    findPetsByStatus  _ (Status status) =
      _mkRequest "GET" ["/pet/findByStatus"]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
        `setQuery` toQueryColl CommaSeparated ("status", Just status)

    data FindPetsByStatus
    -- | @application/xml@
    instance Produces FindPetsByStatus MimeXML
    -- | @application/json@
    instance Produces FindPetsByStatus MimeJSON

    -- *** findPetsByTags

    -- | @GET \/pet\/findByTags@
    --
    -- Finds Pets by tags
    --
    -- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
    --
    -- AuthMethod: 'AuthOAuthPetstoreAuth'
    --
    findPetsByTags
      :: Accept accept -- ^ request accept ('MimeType')
      -> Tags -- ^ "tags" -  Tags to filter by
      -> SwaggerPetstoreRequest FindPetsByTags MimeNoContent [Pet] accept
    findPetsByTags  _ (Tags tags) =
      _mkRequest "GET" ["/pet/findByTags"]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
        `setQuery` toQueryColl CommaSeparated ("tags", Just tags)

    {-# DEPRECATED findPetsByTags "" #-}

    data FindPetsByTags
    -- | @application/xml@
    instance Produces FindPetsByTags MimeXML
    -- | @application/json@
    instance Produces FindPetsByTags MimeJSON

    -- *** getPetById

    -- | @GET \/pet\/{petId}@
    --
    -- Find pet by ID
    --
    -- Returns a single pet
    --
    -- AuthMethod: 'AuthApiKeyApiKey'
    --
    getPetById
      :: Accept accept -- ^ request accept ('MimeType')
      -> PetId -- ^ "petId" -  ID of pet to return
      -> SwaggerPetstoreRequest GetPetById MimeNoContent Pet accept
    getPetById  _ (PetId petId) =
      _mkRequest "GET" ["/pet/",toPath petId]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)

    data GetPetById
    -- | @application/xml@
    instance Produces GetPetById MimeXML
    -- | @application/json@
    instance Produces GetPetById MimeJSON

    -- *** updatePet

    -- | @PUT \/pet@
    --
    -- Update an existing pet
    --
    --
    --
    -- AuthMethod: 'AuthOAuthPetstoreAuth'
    --
    -- Note: Has 'Produces' instances, but no response schema
    --
    updatePet
      :: (Consumes UpdatePet contentType, MimeRender contentType Pet)
      => ContentType contentType -- ^ request content-type ('MimeType')
      -> Accept accept -- ^ request accept ('MimeType')
      -> Pet -- ^ "body" -  Pet object that needs to be added to the store
      -> SwaggerPetstoreRequest UpdatePet contentType res accept
    updatePet _  _ body =
      _mkRequest "PUT" ["/pet"]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
        `setBodyParam` body

    data UpdatePet

    -- | /Body Param/ "body" - Pet object that needs to be added to the store
    instance HasBodyParam UpdatePet Pet

    -- | @application/json@
    instance Consumes UpdatePet MimeJSON
    -- | @application/xml@
    instance Consumes UpdatePet MimeXML

    -- | @application/xml@
    instance Produces UpdatePet MimeXML
    -- | @application/json@
    instance Produces UpdatePet MimeJSON

    -- *** updatePetWithForm

    -- | @POST \/pet\/{petId}@
    --
    -- Updates a pet in the store with form data
    --
    --
    --
    -- AuthMethod: 'AuthOAuthPetstoreAuth'
    --
    -- Note: Has 'Produces' instances, but no response schema
    --
    updatePetWithForm
      :: (Consumes UpdatePetWithForm MimeFormUrlEncoded)
      => Accept accept -- ^ request accept ('MimeType')
      -> PetId -- ^ "petId" -  ID of pet that needs to be updated
      -> SwaggerPetstoreRequest UpdatePetWithForm MimeFormUrlEncoded res accept
    updatePetWithForm  _ (PetId petId) =
      _mkRequest "POST" ["/pet/",toPath petId]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)

    data UpdatePetWithForm

    -- | /Optional Param/ "name" - Updated name of the pet
    instance HasOptionalParam UpdatePetWithForm Name2 where
      applyOptionalParam req (Name2 xs) =
        req `addForm` toForm ("name", xs)

    -- | /Optional Param/ "status" - Updated status of the pet
    instance HasOptionalParam UpdatePetWithForm StatusText where
      applyOptionalParam req (StatusText xs) =
        req `addForm` toForm ("status", xs)

    -- | @application/x-www-form-urlencoded@
    instance Consumes UpdatePetWithForm MimeFormUrlEncoded

    -- | @application/xml@
    instance Produces UpdatePetWithForm MimeXML
    -- | @application/json@
    instance Produces UpdatePetWithForm MimeJSON

    -- *** uploadFile

    -- | @POST \/pet\/{petId}\/uploadImage@
    --
    -- uploads an image
    --
    --
    --
    -- AuthMethod: 'AuthOAuthPetstoreAuth'
    --
    uploadFile
      :: (Consumes UploadFile MimeMultipartFormData)
      => PetId -- ^ "petId" -  ID of pet to update
      -> SwaggerPetstoreRequest UploadFile MimeMultipartFormData ApiResponse MimeJSON
    uploadFile (PetId petId) =
      _mkRequest "POST" ["/pet/",toPath petId,"/uploadImage"]
        `_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)

    data UploadFile

    -- | /Optional Param/ "additionalMetadata" - Additional data to pass to server
    instance HasOptionalParam UploadFile AdditionalMetadata where
      applyOptionalParam req (AdditionalMetadata xs) =
        req `_addMultiFormPart` NH.partLBS "additionalMetadata" (mimeRender' MimeMultipartFormData xs)

    -- | /Optional Param/ "file" - file to upload
    instance HasOptionalParam UploadFile File where
      applyOptionalParam req (File xs) =
        req `_addMultiFormPart` NH.partFileSource "file" xs

    -- | @multipart/form-data@
    instance Consumes UploadFile MimeMultipartFormData

    -- | @application/json@
    instance Produces UploadFile MimeJSON