{-# 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.Fake 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
createXmlItem
:: (Consumes CreateXmlItem contentType, MimeRender contentType XmlItem)
=> ContentType contentType
-> XmlItem
-> OpenAPIPetstoreRequest CreateXmlItem contentType NoContent MimeNoContent
createXmlItem _ xmlItem =
_mkRequest "POST" ["/fake/create_xml_item"]
`setBodyParam` xmlItem
data CreateXmlItem
instance HasBodyParam CreateXmlItem XmlItem
instance Consumes CreateXmlItem MimeXML
instance Consumes CreateXmlItem MimeTextxml
instance Consumes CreateXmlItem MimeTextxmlCharsetutf8
instance Consumes CreateXmlItem MimeTextxmlCharsetutf16
instance Consumes CreateXmlItem MimeXmlCharsetutf8
instance Consumes CreateXmlItem MimeXmlCharsetutf16
instance Produces CreateXmlItem MimeNoContent
fakeOuterBooleanSerialize
:: (Consumes FakeOuterBooleanSerialize contentType)
=> ContentType contentType
-> Accept accept
-> OpenAPIPetstoreRequest FakeOuterBooleanSerialize contentType Bool accept
fakeOuterBooleanSerialize _ _ =
_mkRequest "POST" ["/fake/outer/boolean"]
data FakeOuterBooleanSerialize
instance HasBodyParam FakeOuterBooleanSerialize BodyBool
instance MimeType mtype => Consumes FakeOuterBooleanSerialize mtype
instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype
fakeOuterCompositeSerialize
:: (Consumes FakeOuterCompositeSerialize contentType)
=> ContentType contentType
-> Accept accept
-> OpenAPIPetstoreRequest FakeOuterCompositeSerialize contentType OuterComposite accept
fakeOuterCompositeSerialize _ _ =
_mkRequest "POST" ["/fake/outer/composite"]
data FakeOuterCompositeSerialize
instance HasBodyParam FakeOuterCompositeSerialize OuterComposite
instance MimeType mtype => Consumes FakeOuterCompositeSerialize mtype
instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype
fakeOuterNumberSerialize
:: (Consumes FakeOuterNumberSerialize contentType)
=> ContentType contentType
-> Accept accept
-> OpenAPIPetstoreRequest FakeOuterNumberSerialize contentType Double accept
fakeOuterNumberSerialize _ _ =
_mkRequest "POST" ["/fake/outer/number"]
data FakeOuterNumberSerialize
instance HasBodyParam FakeOuterNumberSerialize BodyDouble
instance MimeType mtype => Consumes FakeOuterNumberSerialize mtype
instance MimeType mtype => Produces FakeOuterNumberSerialize mtype
fakeOuterStringSerialize
:: (Consumes FakeOuterStringSerialize contentType)
=> ContentType contentType
-> Accept accept
-> OpenAPIPetstoreRequest FakeOuterStringSerialize contentType Text accept
fakeOuterStringSerialize _ _ =
_mkRequest "POST" ["/fake/outer/string"]
data FakeOuterStringSerialize
instance HasBodyParam FakeOuterStringSerialize BodyText
instance MimeType mtype => Consumes FakeOuterStringSerialize mtype
instance MimeType mtype => Produces FakeOuterStringSerialize mtype
testBodyWithFileSchema
:: (Consumes TestBodyWithFileSchema MimeJSON, MimeRender MimeJSON FileSchemaTestClass)
=> FileSchemaTestClass
-> OpenAPIPetstoreRequest TestBodyWithFileSchema MimeJSON NoContent MimeNoContent
testBodyWithFileSchema body =
_mkRequest "PUT" ["/fake/body-with-file-schema"]
`setBodyParam` body
data TestBodyWithFileSchema
instance HasBodyParam TestBodyWithFileSchema FileSchemaTestClass
instance Consumes TestBodyWithFileSchema MimeJSON
instance Produces TestBodyWithFileSchema MimeNoContent
testBodyWithQueryParams
:: (Consumes TestBodyWithQueryParams MimeJSON, MimeRender MimeJSON User)
=> User
-> Query
-> OpenAPIPetstoreRequest TestBodyWithQueryParams MimeJSON NoContent MimeNoContent
testBodyWithQueryParams body (Query query) =
_mkRequest "PUT" ["/fake/body-with-query-params"]
`setBodyParam` body
`setQuery` toQuery ("query", Just query)
data TestBodyWithQueryParams
instance HasBodyParam TestBodyWithQueryParams User
instance Consumes TestBodyWithQueryParams MimeJSON
instance Produces TestBodyWithQueryParams MimeNoContent
testClientModel
:: (Consumes TestClientModel MimeJSON, MimeRender MimeJSON Client)
=> Client
-> OpenAPIPetstoreRequest TestClientModel MimeJSON Client MimeJSON
testClientModel body =
_mkRequest "PATCH" ["/fake"]
`setBodyParam` body
data TestClientModel
instance HasBodyParam TestClientModel Client
instance Consumes TestClientModel MimeJSON
instance Produces TestClientModel MimeJSON
testEndpointParameters
:: (Consumes TestEndpointParameters MimeFormUrlEncoded)
=> Number
-> ParamDouble
-> PatternWithoutDelimiter
-> Byte
-> OpenAPIPetstoreRequest TestEndpointParameters MimeFormUrlEncoded NoContent MimeNoContent
testEndpointParameters (Number number) (ParamDouble double) (PatternWithoutDelimiter patternWithoutDelimiter) (Byte byte) =
_mkRequest "POST" ["/fake"]
`_hasAuthType` (P.Proxy :: P.Proxy AuthBasicHttpBasicTest)
`addForm` toForm ("number", number)
`addForm` toForm ("double", double)
`addForm` toForm ("pattern_without_delimiter", patternWithoutDelimiter)
`addForm` toForm ("byte", byte)
data TestEndpointParameters
instance HasOptionalParam TestEndpointParameters ParamInteger where
applyOptionalParam req (ParamInteger xs) =
req `addForm` toForm ("integer", xs)
instance HasOptionalParam TestEndpointParameters Int32 where
applyOptionalParam req (Int32 xs) =
req `addForm` toForm ("int32", xs)
instance HasOptionalParam TestEndpointParameters Int64 where
applyOptionalParam req (Int64 xs) =
req `addForm` toForm ("int64", xs)
instance HasOptionalParam TestEndpointParameters ParamFloat where
applyOptionalParam req (ParamFloat xs) =
req `addForm` toForm ("float", xs)
instance HasOptionalParam TestEndpointParameters ParamString where
applyOptionalParam req (ParamString xs) =
req `addForm` toForm ("string", xs)
instance HasOptionalParam TestEndpointParameters ParamBinary where
applyOptionalParam req (ParamBinary xs) =
req `_addMultiFormPart` NH.partFileSource "binary" xs
instance HasOptionalParam TestEndpointParameters ParamDate where
applyOptionalParam req (ParamDate xs) =
req `addForm` toForm ("date", xs)
instance HasOptionalParam TestEndpointParameters ParamDateTime where
applyOptionalParam req (ParamDateTime xs) =
req `addForm` toForm ("dateTime", xs)
instance HasOptionalParam TestEndpointParameters Password where
applyOptionalParam req (Password xs) =
req `addForm` toForm ("password", xs)
instance HasOptionalParam TestEndpointParameters Callback where
applyOptionalParam req (Callback xs) =
req `addForm` toForm ("callback", xs)
instance Consumes TestEndpointParameters MimeFormUrlEncoded
instance Produces TestEndpointParameters MimeNoContent
testEnumParameters
:: (Consumes TestEnumParameters MimeFormUrlEncoded)
=> OpenAPIPetstoreRequest TestEnumParameters MimeFormUrlEncoded NoContent MimeNoContent
testEnumParameters =
_mkRequest "GET" ["/fake"]
data TestEnumParameters
instance HasOptionalParam TestEnumParameters EnumFormStringArray where
applyOptionalParam req (EnumFormStringArray xs) =
req `addForm` toFormColl CommaSeparated ("enum_form_string_array", xs)
instance HasOptionalParam TestEnumParameters EnumFormString where
applyOptionalParam req (EnumFormString xs) =
req `addForm` toForm ("enum_form_string", xs)
instance HasOptionalParam TestEnumParameters EnumHeaderStringArray where
applyOptionalParam req (EnumHeaderStringArray xs) =
req `setHeader` toHeaderColl CommaSeparated ("enum_header_string_array", xs)
instance HasOptionalParam TestEnumParameters EnumHeaderString where
applyOptionalParam req (EnumHeaderString xs) =
req `setHeader` toHeader ("enum_header_string", xs)
instance HasOptionalParam TestEnumParameters EnumQueryStringArray where
applyOptionalParam req (EnumQueryStringArray xs) =
req `setQuery` toQueryColl CommaSeparated ("enum_query_string_array", Just xs)
instance HasOptionalParam TestEnumParameters EnumQueryString where
applyOptionalParam req (EnumQueryString xs) =
req `setQuery` toQuery ("enum_query_string", Just xs)
instance HasOptionalParam TestEnumParameters EnumQueryInteger where
applyOptionalParam req (EnumQueryInteger xs) =
req `setQuery` toQuery ("enum_query_integer", Just xs)
instance HasOptionalParam TestEnumParameters EnumQueryDouble where
applyOptionalParam req (EnumQueryDouble xs) =
req `setQuery` toQuery ("enum_query_double", Just xs)
instance Consumes TestEnumParameters MimeFormUrlEncoded
instance Produces TestEnumParameters MimeNoContent
testGroupParameters
:: RequiredStringGroup
-> RequiredBooleanGroup
-> RequiredInt64Group
-> OpenAPIPetstoreRequest TestGroupParameters MimeNoContent NoContent MimeNoContent
testGroupParameters (RequiredStringGroup requiredStringGroup) (RequiredBooleanGroup requiredBooleanGroup) (RequiredInt64Group requiredInt64Group) =
_mkRequest "DELETE" ["/fake"]
`setQuery` toQuery ("required_string_group", Just requiredStringGroup)
`setHeader` toHeader ("required_boolean_group", requiredBooleanGroup)
`setQuery` toQuery ("required_int64_group", Just requiredInt64Group)
data TestGroupParameters
instance HasOptionalParam TestGroupParameters StringGroup where
applyOptionalParam req (StringGroup xs) =
req `setQuery` toQuery ("string_group", Just xs)
instance HasOptionalParam TestGroupParameters BooleanGroup where
applyOptionalParam req (BooleanGroup xs) =
req `setHeader` toHeader ("boolean_group", xs)
instance HasOptionalParam TestGroupParameters Int64Group where
applyOptionalParam req (Int64Group xs) =
req `setQuery` toQuery ("int64_group", Just xs)
instance Produces TestGroupParameters MimeNoContent
testInlineAdditionalProperties
:: (Consumes TestInlineAdditionalProperties MimeJSON, MimeRender MimeJSON ParamMapMapStringText)
=> ParamMapMapStringText
-> OpenAPIPetstoreRequest TestInlineAdditionalProperties MimeJSON NoContent MimeNoContent
testInlineAdditionalProperties param =
_mkRequest "POST" ["/fake/inline-additionalProperties"]
`setBodyParam` param
data TestInlineAdditionalProperties
instance HasBodyParam TestInlineAdditionalProperties ParamMapMapStringText
instance Consumes TestInlineAdditionalProperties MimeJSON
instance Produces TestInlineAdditionalProperties MimeNoContent
testJsonFormData
:: (Consumes TestJsonFormData MimeFormUrlEncoded)
=> Param
-> Param2
-> OpenAPIPetstoreRequest TestJsonFormData MimeFormUrlEncoded NoContent MimeNoContent
testJsonFormData (Param param) (Param2 param2) =
_mkRequest "GET" ["/fake/jsonFormData"]
`addForm` toForm ("param", param)
`addForm` toForm ("param2", param2)
data TestJsonFormData
instance Consumes TestJsonFormData MimeFormUrlEncoded
instance Produces TestJsonFormData MimeNoContent