{-# 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 OpenAPIPetstore.API.Pet where
import OpenAPIPetstore.Core
import OpenAPIPetstore.MimeTypes
import OpenAPIPetstore.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
addPet
:: (Consumes AddPet contentType, MimeRender contentType Pet)
=> ContentType contentType
-> Pet
-> OpenAPIPetstoreRequest AddPet contentType NoContent MimeNoContent
addPet _ body =
_mkRequest "POST" ["/pet"]
`_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
`setBodyParam` body
data AddPet
instance HasBodyParam AddPet Pet
instance Consumes AddPet MimeXML
instance Consumes AddPet MimeJSON
instance Produces AddPet MimeNoContent
deletePet
:: PetId
-> OpenAPIPetstoreRequest DeletePet MimeNoContent NoContent MimeNoContent
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)
instance Produces DeletePet MimeNoContent
findPetsByStatus
:: Accept accept
-> Status
-> OpenAPIPetstoreRequest 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
instance Produces FindPetsByStatus MimeXML
instance Produces FindPetsByStatus MimeJSON
findPetsByTags
:: Accept accept
-> Tags
-> OpenAPIPetstoreRequest 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
instance Produces FindPetsByTags MimeXML
instance Produces FindPetsByTags MimeJSON
getPetById
:: Accept accept
-> PetId
-> OpenAPIPetstoreRequest GetPetById MimeNoContent Pet accept
getPetById _ (PetId petId) =
_mkRequest "GET" ["/pet/",toPath petId]
`_hasAuthType` (P.Proxy :: P.Proxy AuthApiKeyApiKey)
data GetPetById
instance Produces GetPetById MimeXML
instance Produces GetPetById MimeJSON
updatePet
:: (Consumes UpdatePet contentType, MimeRender contentType Pet)
=> ContentType contentType
-> Pet
-> OpenAPIPetstoreRequest UpdatePet contentType NoContent MimeNoContent
updatePet _ body =
_mkRequest "PUT" ["/pet"]
`_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
`setBodyParam` body
data UpdatePet
instance HasBodyParam UpdatePet Pet
instance Consumes UpdatePet MimeXML
instance Consumes UpdatePet MimeJSON
instance Produces UpdatePet MimeNoContent
updatePetWithForm
:: (Consumes UpdatePetWithForm MimeFormUrlEncoded)
=> PetId
-> OpenAPIPetstoreRequest UpdatePetWithForm MimeFormUrlEncoded NoContent MimeNoContent
updatePetWithForm (PetId petId) =
_mkRequest "POST" ["/pet/",toPath petId]
`_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
data UpdatePetWithForm
instance HasOptionalParam UpdatePetWithForm Name2 where
applyOptionalParam req (Name2 xs) =
req `addForm` toForm ("name", xs)
instance HasOptionalParam UpdatePetWithForm StatusText where
applyOptionalParam req (StatusText xs) =
req `addForm` toForm ("status", xs)
instance Consumes UpdatePetWithForm MimeFormUrlEncoded
instance Produces UpdatePetWithForm MimeNoContent
uploadFile
:: (Consumes UploadFile MimeMultipartFormData)
=> PetId
-> OpenAPIPetstoreRequest UploadFile MimeMultipartFormData ApiResponse MimeJSON
uploadFile (PetId petId) =
_mkRequest "POST" ["/pet/",toPath petId,"/uploadImage"]
`_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
data UploadFile
instance HasOptionalParam UploadFile AdditionalMetadata where
applyOptionalParam req (AdditionalMetadata xs) =
req `_addMultiFormPart` NH.partLBS "additionalMetadata" (mimeRender' MimeMultipartFormData xs)
instance HasOptionalParam UploadFile File2 where
applyOptionalParam req (File2 xs) =
req `_addMultiFormPart` NH.partFileSource "file" xs
instance Consumes UploadFile MimeMultipartFormData
instance Produces UploadFile MimeJSON
uploadFileWithRequiredFile
:: (Consumes UploadFileWithRequiredFile MimeMultipartFormData)
=> RequiredFile
-> PetId
-> OpenAPIPetstoreRequest UploadFileWithRequiredFile MimeMultipartFormData ApiResponse MimeJSON
uploadFileWithRequiredFile (RequiredFile requiredFile) (PetId petId) =
_mkRequest "POST" ["/fake/",toPath petId,"/uploadImageWithRequiredFile"]
`_hasAuthType` (P.Proxy :: P.Proxy AuthOAuthPetstoreAuth)
`_addMultiFormPart` NH.partFileSource "requiredFile" requiredFile
data UploadFileWithRequiredFile
instance HasOptionalParam UploadFileWithRequiredFile AdditionalMetadata where
applyOptionalParam req (AdditionalMetadata xs) =
req `_addMultiFormPart` NH.partLBS "additionalMetadata" (mimeRender' MimeMultipartFormData xs)
instance Consumes UploadFileWithRequiredFile MimeMultipartFormData
instance Produces UploadFileWithRequiredFile MimeJSON