{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-matches -fno-warn-unused-binds -fno-warn-unused-imports #-}
module OpenAPIPetstore.Model where
import OpenAPIPetstore.Core
import OpenAPIPetstore.MimeTypes
import Data.Aeson ((.:),(.:!),(.:?),(.=))
import qualified Control.Arrow as P (left)
import qualified Data.Aeson as A
import qualified Data.ByteString as B
import qualified Data.ByteString.Base64 as B64
import qualified Data.ByteString.Char8 as BC
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.HashMap.Lazy as HM
import qualified Data.Map as Map
import qualified Data.Maybe as P
import qualified Data.Set as Set
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Time as TI
import qualified Lens.Micro as L
import qualified Web.FormUrlEncoded as WH
import qualified Web.HttpApiData as WH
import Control.Applicative ((<|>))
import Control.Applicative (Alternative)
import Data.Function ((&))
import Data.Monoid ((<>))
import Data.Text (Text)
import Prelude (($),(/=),(.),(<$>),(<*>),(>>=),(=<<),Maybe(..),Bool(..),Char,Double,FilePath,Float,Int,Integer,String,fmap,undefined,mempty,maybe,pure,Monad,Applicative,Functor)
import qualified Prelude as P
newtype AdditionalMetadata = AdditionalMetadata { unAdditionalMetadata :: Text } deriving (P.Eq, P.Show)
newtype ApiKey = ApiKey { unApiKey :: Text } deriving (P.Eq, P.Show)
newtype Body = Body { unBody :: [User] } deriving (P.Eq, P.Show, A.ToJSON)
newtype BodyBool = BodyBool { unBodyBool :: Bool } deriving (P.Eq, P.Show, A.ToJSON)
newtype BodyDouble = BodyDouble { unBodyDouble :: Double } deriving (P.Eq, P.Show, A.ToJSON)
newtype BodyText = BodyText { unBodyText :: Text } deriving (P.Eq, P.Show, A.ToJSON)
newtype BooleanGroup = BooleanGroup { unBooleanGroup :: Bool } deriving (P.Eq, P.Show)
newtype Byte = Byte { unByte :: ByteArray } deriving (P.Eq, P.Show)
newtype Callback = Callback { unCallback :: Text } deriving (P.Eq, P.Show)
newtype EnumFormString = EnumFormString { unEnumFormString :: E'EnumFormString } deriving (P.Eq, P.Show)
newtype EnumFormStringArray = EnumFormStringArray { unEnumFormStringArray :: [E'EnumFormStringArray] } deriving (P.Eq, P.Show)
newtype EnumHeaderString = EnumHeaderString { unEnumHeaderString :: E'EnumFormString } deriving (P.Eq, P.Show)
newtype EnumHeaderStringArray = EnumHeaderStringArray { unEnumHeaderStringArray :: [E'EnumFormStringArray] } deriving (P.Eq, P.Show)
newtype EnumQueryDouble = EnumQueryDouble { unEnumQueryDouble :: E'EnumNumber } deriving (P.Eq, P.Show)
newtype EnumQueryInteger = EnumQueryInteger { unEnumQueryInteger :: E'EnumQueryInteger } deriving (P.Eq, P.Show)
newtype EnumQueryString = EnumQueryString { unEnumQueryString :: E'EnumFormString } deriving (P.Eq, P.Show)
newtype EnumQueryStringArray = EnumQueryStringArray { unEnumQueryStringArray :: [E'EnumFormStringArray] } deriving (P.Eq, P.Show)
newtype File2 = File2 { unFile2 :: FilePath } deriving (P.Eq, P.Show)
newtype Int32 = Int32 { unInt32 :: Int } deriving (P.Eq, P.Show)
newtype Int64 = Int64 { unInt64 :: Integer } deriving (P.Eq, P.Show)
newtype Int64Group = Int64Group { unInt64Group :: Integer } deriving (P.Eq, P.Show)
newtype Name2 = Name2 { unName2 :: Text } deriving (P.Eq, P.Show)
newtype Number = Number { unNumber :: Double } deriving (P.Eq, P.Show)
newtype OrderId = OrderId { unOrderId :: Integer } deriving (P.Eq, P.Show)
newtype OrderIdText = OrderIdText { unOrderIdText :: Text } deriving (P.Eq, P.Show)
newtype Param = Param { unParam :: Text } deriving (P.Eq, P.Show)
newtype Param2 = Param2 { unParam2 :: Text } deriving (P.Eq, P.Show)
newtype ParamBinary = ParamBinary { unParamBinary :: FilePath } deriving (P.Eq, P.Show)
newtype ParamDate = ParamDate { unParamDate :: Date } deriving (P.Eq, P.Show)
newtype ParamDateTime = ParamDateTime { unParamDateTime :: DateTime } deriving (P.Eq, P.Show)
newtype ParamDouble = ParamDouble { unParamDouble :: Double } deriving (P.Eq, P.Show)
newtype ParamFloat = ParamFloat { unParamFloat :: Float } deriving (P.Eq, P.Show)
newtype ParamInteger = ParamInteger { unParamInteger :: Int } deriving (P.Eq, P.Show)
newtype ParamMapMapStringText = ParamMapMapStringText { unParamMapMapStringText :: (Map.Map String Text) } deriving (P.Eq, P.Show, A.ToJSON)
newtype ParamString = ParamString { unParamString :: Text } deriving (P.Eq, P.Show)
newtype Password = Password { unPassword :: Text } deriving (P.Eq, P.Show)
newtype PatternWithoutDelimiter = PatternWithoutDelimiter { unPatternWithoutDelimiter :: Text } deriving (P.Eq, P.Show)
newtype PetId = PetId { unPetId :: Integer } deriving (P.Eq, P.Show)
newtype Query = Query { unQuery :: Text } deriving (P.Eq, P.Show)
newtype RequiredBooleanGroup = RequiredBooleanGroup { unRequiredBooleanGroup :: Bool } deriving (P.Eq, P.Show)
newtype RequiredFile = RequiredFile { unRequiredFile :: FilePath } deriving (P.Eq, P.Show)
newtype RequiredInt64Group = RequiredInt64Group { unRequiredInt64Group :: Integer } deriving (P.Eq, P.Show)
newtype RequiredStringGroup = RequiredStringGroup { unRequiredStringGroup :: Int } deriving (P.Eq, P.Show)
newtype Status = Status { unStatus :: [E'Status2] } deriving (P.Eq, P.Show)
newtype StatusText = StatusText { unStatusText :: Text } deriving (P.Eq, P.Show)
newtype StringGroup = StringGroup { unStringGroup :: Int } deriving (P.Eq, P.Show)
newtype Tags = Tags { unTags :: [Text] } deriving (P.Eq, P.Show)
newtype Username = Username { unUsername :: Text } deriving (P.Eq, P.Show)
data AdditionalPropertiesClass = AdditionalPropertiesClass
{ additionalPropertiesClassMapProperty :: !(Maybe (Map.Map String Text))
, additionalPropertiesClassMapOfMapProperty :: !(Maybe (Map.Map String (Map.Map String Text)))
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON AdditionalPropertiesClass where
parseJSON = A.withObject "AdditionalPropertiesClass" $ \o ->
AdditionalPropertiesClass
<$> (o .:? "map_property")
<*> (o .:? "map_of_map_property")
instance A.ToJSON AdditionalPropertiesClass where
toJSON AdditionalPropertiesClass {..} =
_omitNulls
[ "map_property" .= additionalPropertiesClassMapProperty
, "map_of_map_property" .= additionalPropertiesClassMapOfMapProperty
]
mkAdditionalPropertiesClass
:: AdditionalPropertiesClass
mkAdditionalPropertiesClass =
AdditionalPropertiesClass
{ additionalPropertiesClassMapProperty = Nothing
, additionalPropertiesClassMapOfMapProperty = Nothing
}
data Animal = Animal
{ animalClassName :: !(Text)
, animalColor :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Animal where
parseJSON = A.withObject "Animal" $ \o ->
Animal
<$> (o .: "className")
<*> (o .:? "color")
instance A.ToJSON Animal where
toJSON Animal {..} =
_omitNulls
[ "className" .= animalClassName
, "color" .= animalColor
]
mkAnimal
:: Text
-> Animal
mkAnimal animalClassName =
Animal
{ animalClassName
, animalColor = Nothing
}
data ApiResponse = ApiResponse
{ apiResponseCode :: !(Maybe Int)
, apiResponseType :: !(Maybe Text)
, apiResponseMessage :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ApiResponse where
parseJSON = A.withObject "ApiResponse" $ \o ->
ApiResponse
<$> (o .:? "code")
<*> (o .:? "type")
<*> (o .:? "message")
instance A.ToJSON ApiResponse where
toJSON ApiResponse {..} =
_omitNulls
[ "code" .= apiResponseCode
, "type" .= apiResponseType
, "message" .= apiResponseMessage
]
mkApiResponse
:: ApiResponse
mkApiResponse =
ApiResponse
{ apiResponseCode = Nothing
, apiResponseType = Nothing
, apiResponseMessage = Nothing
}
data ArrayOfArrayOfNumberOnly = ArrayOfArrayOfNumberOnly
{ arrayOfArrayOfNumberOnlyArrayArrayNumber :: !(Maybe [[Double]])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ArrayOfArrayOfNumberOnly where
parseJSON = A.withObject "ArrayOfArrayOfNumberOnly" $ \o ->
ArrayOfArrayOfNumberOnly
<$> (o .:? "ArrayArrayNumber")
instance A.ToJSON ArrayOfArrayOfNumberOnly where
toJSON ArrayOfArrayOfNumberOnly {..} =
_omitNulls
[ "ArrayArrayNumber" .= arrayOfArrayOfNumberOnlyArrayArrayNumber
]
mkArrayOfArrayOfNumberOnly
:: ArrayOfArrayOfNumberOnly
mkArrayOfArrayOfNumberOnly =
ArrayOfArrayOfNumberOnly
{ arrayOfArrayOfNumberOnlyArrayArrayNumber = Nothing
}
data ArrayOfNumberOnly = ArrayOfNumberOnly
{ arrayOfNumberOnlyArrayNumber :: !(Maybe [Double])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ArrayOfNumberOnly where
parseJSON = A.withObject "ArrayOfNumberOnly" $ \o ->
ArrayOfNumberOnly
<$> (o .:? "ArrayNumber")
instance A.ToJSON ArrayOfNumberOnly where
toJSON ArrayOfNumberOnly {..} =
_omitNulls
[ "ArrayNumber" .= arrayOfNumberOnlyArrayNumber
]
mkArrayOfNumberOnly
:: ArrayOfNumberOnly
mkArrayOfNumberOnly =
ArrayOfNumberOnly
{ arrayOfNumberOnlyArrayNumber = Nothing
}
data ArrayTest = ArrayTest
{ arrayTestArrayOfString :: !(Maybe [Text])
, arrayTestArrayArrayOfInteger :: !(Maybe [[Integer]])
, arrayTestArrayArrayOfModel :: !(Maybe [[ReadOnlyFirst]])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ArrayTest where
parseJSON = A.withObject "ArrayTest" $ \o ->
ArrayTest
<$> (o .:? "array_of_string")
<*> (o .:? "array_array_of_integer")
<*> (o .:? "array_array_of_model")
instance A.ToJSON ArrayTest where
toJSON ArrayTest {..} =
_omitNulls
[ "array_of_string" .= arrayTestArrayOfString
, "array_array_of_integer" .= arrayTestArrayArrayOfInteger
, "array_array_of_model" .= arrayTestArrayArrayOfModel
]
mkArrayTest
:: ArrayTest
mkArrayTest =
ArrayTest
{ arrayTestArrayOfString = Nothing
, arrayTestArrayArrayOfInteger = Nothing
, arrayTestArrayArrayOfModel = Nothing
}
data Capitalization = Capitalization
{ capitalizationSmallCamel :: !(Maybe Text)
, capitalizationCapitalCamel :: !(Maybe Text)
, capitalizationSmallSnake :: !(Maybe Text)
, capitalizationCapitalSnake :: !(Maybe Text)
, capitalizationScaEthFlowPoints :: !(Maybe Text)
, capitalizationAttName :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Capitalization where
parseJSON = A.withObject "Capitalization" $ \o ->
Capitalization
<$> (o .:? "smallCamel")
<*> (o .:? "CapitalCamel")
<*> (o .:? "small_Snake")
<*> (o .:? "Capital_Snake")
<*> (o .:? "SCA_ETH_Flow_Points")
<*> (o .:? "ATT_NAME")
instance A.ToJSON Capitalization where
toJSON Capitalization {..} =
_omitNulls
[ "smallCamel" .= capitalizationSmallCamel
, "CapitalCamel" .= capitalizationCapitalCamel
, "small_Snake" .= capitalizationSmallSnake
, "Capital_Snake" .= capitalizationCapitalSnake
, "SCA_ETH_Flow_Points" .= capitalizationScaEthFlowPoints
, "ATT_NAME" .= capitalizationAttName
]
mkCapitalization
:: Capitalization
mkCapitalization =
Capitalization
{ capitalizationSmallCamel = Nothing
, capitalizationCapitalCamel = Nothing
, capitalizationSmallSnake = Nothing
, capitalizationCapitalSnake = Nothing
, capitalizationScaEthFlowPoints = Nothing
, capitalizationAttName = Nothing
}
data Cat = Cat
{ catClassName :: !(Text)
, catColor :: !(Maybe Text)
, catDeclawed :: !(Maybe Bool)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Cat where
parseJSON = A.withObject "Cat" $ \o ->
Cat
<$> (o .: "className")
<*> (o .:? "color")
<*> (o .:? "declawed")
instance A.ToJSON Cat where
toJSON Cat {..} =
_omitNulls
[ "className" .= catClassName
, "color" .= catColor
, "declawed" .= catDeclawed
]
mkCat
:: Text
-> Cat
mkCat catClassName =
Cat
{ catClassName
, catColor = Nothing
, catDeclawed = Nothing
}
data Category = Category
{ categoryId :: !(Maybe Integer)
, categoryName :: !(Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Category where
parseJSON = A.withObject "Category" $ \o ->
Category
<$> (o .:? "id")
<*> (o .: "name")
instance A.ToJSON Category where
toJSON Category {..} =
_omitNulls
[ "id" .= categoryId
, "name" .= categoryName
]
mkCategory
:: Text
-> Category
mkCategory categoryName =
Category
{ categoryId = Nothing
, categoryName
}
data ClassModel = ClassModel
{ classModelClass :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ClassModel where
parseJSON = A.withObject "ClassModel" $ \o ->
ClassModel
<$> (o .:? "_class")
instance A.ToJSON ClassModel where
toJSON ClassModel {..} =
_omitNulls
[ "_class" .= classModelClass
]
mkClassModel
:: ClassModel
mkClassModel =
ClassModel
{ classModelClass = Nothing
}
data Client = Client
{ clientClient :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Client where
parseJSON = A.withObject "Client" $ \o ->
Client
<$> (o .:? "client")
instance A.ToJSON Client where
toJSON Client {..} =
_omitNulls
[ "client" .= clientClient
]
mkClient
:: Client
mkClient =
Client
{ clientClient = Nothing
}
data Dog = Dog
{ dogClassName :: !(Text)
, dogColor :: !(Maybe Text)
, dogBreed :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Dog where
parseJSON = A.withObject "Dog" $ \o ->
Dog
<$> (o .: "className")
<*> (o .:? "color")
<*> (o .:? "breed")
instance A.ToJSON Dog where
toJSON Dog {..} =
_omitNulls
[ "className" .= dogClassName
, "color" .= dogColor
, "breed" .= dogBreed
]
mkDog
:: Text
-> Dog
mkDog dogClassName =
Dog
{ dogClassName
, dogColor = Nothing
, dogBreed = Nothing
}
data EnumArrays = EnumArrays
{ enumArraysJustSymbol :: !(Maybe E'JustSymbol)
, enumArraysArrayEnum :: !(Maybe [E'ArrayEnum])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON EnumArrays where
parseJSON = A.withObject "EnumArrays" $ \o ->
EnumArrays
<$> (o .:? "just_symbol")
<*> (o .:? "array_enum")
instance A.ToJSON EnumArrays where
toJSON EnumArrays {..} =
_omitNulls
[ "just_symbol" .= enumArraysJustSymbol
, "array_enum" .= enumArraysArrayEnum
]
mkEnumArrays
:: EnumArrays
mkEnumArrays =
EnumArrays
{ enumArraysJustSymbol = Nothing
, enumArraysArrayEnum = Nothing
}
data EnumTest = EnumTest
{ enumTestEnumString :: !(Maybe E'EnumString)
, enumTestEnumStringRequired :: !(E'EnumString)
, enumTestEnumInteger :: !(Maybe E'EnumInteger)
, enumTestEnumNumber :: !(Maybe E'EnumNumber)
, enumTestOuterEnum :: !(Maybe OuterEnum)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON EnumTest where
parseJSON = A.withObject "EnumTest" $ \o ->
EnumTest
<$> (o .:? "enum_string")
<*> (o .: "enum_string_required")
<*> (o .:? "enum_integer")
<*> (o .:? "enum_number")
<*> (o .:? "outerEnum")
instance A.ToJSON EnumTest where
toJSON EnumTest {..} =
_omitNulls
[ "enum_string" .= enumTestEnumString
, "enum_string_required" .= enumTestEnumStringRequired
, "enum_integer" .= enumTestEnumInteger
, "enum_number" .= enumTestEnumNumber
, "outerEnum" .= enumTestOuterEnum
]
mkEnumTest
:: E'EnumString
-> EnumTest
mkEnumTest enumTestEnumStringRequired =
EnumTest
{ enumTestEnumString = Nothing
, enumTestEnumStringRequired
, enumTestEnumInteger = Nothing
, enumTestEnumNumber = Nothing
, enumTestOuterEnum = Nothing
}
data File = File
{ fileSourceUri :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON File where
parseJSON = A.withObject "File" $ \o ->
File
<$> (o .:? "sourceURI")
instance A.ToJSON File where
toJSON File {..} =
_omitNulls
[ "sourceURI" .= fileSourceUri
]
mkFile
:: File
mkFile =
File
{ fileSourceUri = Nothing
}
data FileSchemaTestClass = FileSchemaTestClass
{ fileSchemaTestClassFile :: !(Maybe File)
, fileSchemaTestClassFiles :: !(Maybe [File])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON FileSchemaTestClass where
parseJSON = A.withObject "FileSchemaTestClass" $ \o ->
FileSchemaTestClass
<$> (o .:? "file")
<*> (o .:? "files")
instance A.ToJSON FileSchemaTestClass where
toJSON FileSchemaTestClass {..} =
_omitNulls
[ "file" .= fileSchemaTestClassFile
, "files" .= fileSchemaTestClassFiles
]
mkFileSchemaTestClass
:: FileSchemaTestClass
mkFileSchemaTestClass =
FileSchemaTestClass
{ fileSchemaTestClassFile = Nothing
, fileSchemaTestClassFiles = Nothing
}
data FormatTest = FormatTest
{ formatTestInteger :: !(Maybe Int)
, formatTestInt32 :: !(Maybe Int)
, formatTestInt64 :: !(Maybe Integer)
, formatTestNumber :: !(Double)
, formatTestFloat :: !(Maybe Float)
, formatTestDouble :: !(Maybe Double)
, formatTestString :: !(Maybe Text)
, formatTestByte :: !(ByteArray)
, formatTestBinary :: !(Maybe FilePath)
, formatTestDate :: !(Date)
, formatTestDateTime :: !(Maybe DateTime)
, formatTestUuid :: !(Maybe Text)
, formatTestPassword :: !(Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON FormatTest where
parseJSON = A.withObject "FormatTest" $ \o ->
FormatTest
<$> (o .:? "integer")
<*> (o .:? "int32")
<*> (o .:? "int64")
<*> (o .: "number")
<*> (o .:? "float")
<*> (o .:? "double")
<*> (o .:? "string")
<*> (o .: "byte")
<*> (o .:? "binary")
<*> (o .: "date")
<*> (o .:? "dateTime")
<*> (o .:? "uuid")
<*> (o .: "password")
instance A.ToJSON FormatTest where
toJSON FormatTest {..} =
_omitNulls
[ "integer" .= formatTestInteger
, "int32" .= formatTestInt32
, "int64" .= formatTestInt64
, "number" .= formatTestNumber
, "float" .= formatTestFloat
, "double" .= formatTestDouble
, "string" .= formatTestString
, "byte" .= formatTestByte
, "binary" .= formatTestBinary
, "date" .= formatTestDate
, "dateTime" .= formatTestDateTime
, "uuid" .= formatTestUuid
, "password" .= formatTestPassword
]
mkFormatTest
:: Double
-> ByteArray
-> Date
-> Text
-> FormatTest
mkFormatTest formatTestNumber formatTestByte formatTestDate formatTestPassword =
FormatTest
{ formatTestInteger = Nothing
, formatTestInt32 = Nothing
, formatTestInt64 = Nothing
, formatTestNumber
, formatTestFloat = Nothing
, formatTestDouble = Nothing
, formatTestString = Nothing
, formatTestByte
, formatTestBinary = Nothing
, formatTestDate
, formatTestDateTime = Nothing
, formatTestUuid = Nothing
, formatTestPassword
}
data HasOnlyReadOnly = HasOnlyReadOnly
{ hasOnlyReadOnlyBar :: !(Maybe Text)
, hasOnlyReadOnlyFoo :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON HasOnlyReadOnly where
parseJSON = A.withObject "HasOnlyReadOnly" $ \o ->
HasOnlyReadOnly
<$> (o .:? "bar")
<*> (o .:? "foo")
instance A.ToJSON HasOnlyReadOnly where
toJSON HasOnlyReadOnly {..} =
_omitNulls
[ "bar" .= hasOnlyReadOnlyBar
, "foo" .= hasOnlyReadOnlyFoo
]
mkHasOnlyReadOnly
:: HasOnlyReadOnly
mkHasOnlyReadOnly =
HasOnlyReadOnly
{ hasOnlyReadOnlyBar = Nothing
, hasOnlyReadOnlyFoo = Nothing
}
data MapTest = MapTest
{ mapTestMapMapOfString :: !(Maybe (Map.Map String (Map.Map String Text)))
, mapTestMapOfEnumString :: !(Maybe (Map.Map String E'Inner))
, mapTestDirectMap :: !(Maybe (Map.Map String Bool))
, mapTestIndirectMap :: !(Maybe (Map.Map String Bool))
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON MapTest where
parseJSON = A.withObject "MapTest" $ \o ->
MapTest
<$> (o .:? "map_map_of_string")
<*> (o .:? "map_of_enum_string")
<*> (o .:? "direct_map")
<*> (o .:? "indirect_map")
instance A.ToJSON MapTest where
toJSON MapTest {..} =
_omitNulls
[ "map_map_of_string" .= mapTestMapMapOfString
, "map_of_enum_string" .= mapTestMapOfEnumString
, "direct_map" .= mapTestDirectMap
, "indirect_map" .= mapTestIndirectMap
]
mkMapTest
:: MapTest
mkMapTest =
MapTest
{ mapTestMapMapOfString = Nothing
, mapTestMapOfEnumString = Nothing
, mapTestDirectMap = Nothing
, mapTestIndirectMap = Nothing
}
data MixedPropertiesAndAdditionalPropertiesClass = MixedPropertiesAndAdditionalPropertiesClass
{ mixedPropertiesAndAdditionalPropertiesClassUuid :: !(Maybe Text)
, mixedPropertiesAndAdditionalPropertiesClassDateTime :: !(Maybe DateTime)
, mixedPropertiesAndAdditionalPropertiesClassMap :: !(Maybe (Map.Map String Animal))
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON MixedPropertiesAndAdditionalPropertiesClass where
parseJSON = A.withObject "MixedPropertiesAndAdditionalPropertiesClass" $ \o ->
MixedPropertiesAndAdditionalPropertiesClass
<$> (o .:? "uuid")
<*> (o .:? "dateTime")
<*> (o .:? "map")
instance A.ToJSON MixedPropertiesAndAdditionalPropertiesClass where
toJSON MixedPropertiesAndAdditionalPropertiesClass {..} =
_omitNulls
[ "uuid" .= mixedPropertiesAndAdditionalPropertiesClassUuid
, "dateTime" .= mixedPropertiesAndAdditionalPropertiesClassDateTime
, "map" .= mixedPropertiesAndAdditionalPropertiesClassMap
]
mkMixedPropertiesAndAdditionalPropertiesClass
:: MixedPropertiesAndAdditionalPropertiesClass
mkMixedPropertiesAndAdditionalPropertiesClass =
MixedPropertiesAndAdditionalPropertiesClass
{ mixedPropertiesAndAdditionalPropertiesClassUuid = Nothing
, mixedPropertiesAndAdditionalPropertiesClassDateTime = Nothing
, mixedPropertiesAndAdditionalPropertiesClassMap = Nothing
}
data Model200Response = Model200Response
{ model200ResponseName :: !(Maybe Int)
, model200ResponseClass :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Model200Response where
parseJSON = A.withObject "Model200Response" $ \o ->
Model200Response
<$> (o .:? "name")
<*> (o .:? "class")
instance A.ToJSON Model200Response where
toJSON Model200Response {..} =
_omitNulls
[ "name" .= model200ResponseName
, "class" .= model200ResponseClass
]
mkModel200Response
:: Model200Response
mkModel200Response =
Model200Response
{ model200ResponseName = Nothing
, model200ResponseClass = Nothing
}
data ModelList = ModelList
{ modelList123list :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ModelList where
parseJSON = A.withObject "ModelList" $ \o ->
ModelList
<$> (o .:? "123-list")
instance A.ToJSON ModelList where
toJSON ModelList {..} =
_omitNulls
[ "123-list" .= modelList123list
]
mkModelList
:: ModelList
mkModelList =
ModelList
{ modelList123list = Nothing
}
data ModelReturn = ModelReturn
{ modelReturnReturn :: !(Maybe Int)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ModelReturn where
parseJSON = A.withObject "ModelReturn" $ \o ->
ModelReturn
<$> (o .:? "return")
instance A.ToJSON ModelReturn where
toJSON ModelReturn {..} =
_omitNulls
[ "return" .= modelReturnReturn
]
mkModelReturn
:: ModelReturn
mkModelReturn =
ModelReturn
{ modelReturnReturn = Nothing
}
data Name = Name
{ nameName :: !(Int)
, nameSnakeCase :: !(Maybe Int)
, nameProperty :: !(Maybe Text)
, name123number :: !(Maybe Int)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Name where
parseJSON = A.withObject "Name" $ \o ->
Name
<$> (o .: "name")
<*> (o .:? "snake_case")
<*> (o .:? "property")
<*> (o .:? "123Number")
instance A.ToJSON Name where
toJSON Name {..} =
_omitNulls
[ "name" .= nameName
, "snake_case" .= nameSnakeCase
, "property" .= nameProperty
, "123Number" .= name123number
]
mkName
:: Int
-> Name
mkName nameName =
Name
{ nameName
, nameSnakeCase = Nothing
, nameProperty = Nothing
, name123number = Nothing
}
data NumberOnly = NumberOnly
{ numberOnlyJustNumber :: !(Maybe Double)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON NumberOnly where
parseJSON = A.withObject "NumberOnly" $ \o ->
NumberOnly
<$> (o .:? "JustNumber")
instance A.ToJSON NumberOnly where
toJSON NumberOnly {..} =
_omitNulls
[ "JustNumber" .= numberOnlyJustNumber
]
mkNumberOnly
:: NumberOnly
mkNumberOnly =
NumberOnly
{ numberOnlyJustNumber = Nothing
}
data Order = Order
{ orderId :: !(Maybe Integer)
, orderPetId :: !(Maybe Integer)
, orderQuantity :: !(Maybe Int)
, orderShipDate :: !(Maybe DateTime)
, orderStatus :: !(Maybe E'Status)
, orderComplete :: !(Maybe Bool)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Order where
parseJSON = A.withObject "Order" $ \o ->
Order
<$> (o .:? "id")
<*> (o .:? "petId")
<*> (o .:? "quantity")
<*> (o .:? "shipDate")
<*> (o .:? "status")
<*> (o .:? "complete")
instance A.ToJSON Order where
toJSON Order {..} =
_omitNulls
[ "id" .= orderId
, "petId" .= orderPetId
, "quantity" .= orderQuantity
, "shipDate" .= orderShipDate
, "status" .= orderStatus
, "complete" .= orderComplete
]
mkOrder
:: Order
mkOrder =
Order
{ orderId = Nothing
, orderPetId = Nothing
, orderQuantity = Nothing
, orderShipDate = Nothing
, orderStatus = Nothing
, orderComplete = Nothing
}
data OuterComposite = OuterComposite
{ outerCompositeMyNumber :: !(Maybe Double)
, outerCompositeMyString :: !(Maybe Text)
, outerCompositeMyBoolean :: !(Maybe Bool)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON OuterComposite where
parseJSON = A.withObject "OuterComposite" $ \o ->
OuterComposite
<$> (o .:? "my_number")
<*> (o .:? "my_string")
<*> (o .:? "my_boolean")
instance A.ToJSON OuterComposite where
toJSON OuterComposite {..} =
_omitNulls
[ "my_number" .= outerCompositeMyNumber
, "my_string" .= outerCompositeMyString
, "my_boolean" .= outerCompositeMyBoolean
]
mkOuterComposite
:: OuterComposite
mkOuterComposite =
OuterComposite
{ outerCompositeMyNumber = Nothing
, outerCompositeMyString = Nothing
, outerCompositeMyBoolean = Nothing
}
data Pet = Pet
{ petId :: !(Maybe Integer)
, petCategory :: !(Maybe Category)
, petName :: !(Text)
, petPhotoUrls :: !([Text])
, petTags :: !(Maybe [Tag])
, petStatus :: !(Maybe E'Status2)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Pet where
parseJSON = A.withObject "Pet" $ \o ->
Pet
<$> (o .:? "id")
<*> (o .:? "category")
<*> (o .: "name")
<*> (o .: "photoUrls")
<*> (o .:? "tags")
<*> (o .:? "status")
instance A.ToJSON Pet where
toJSON Pet {..} =
_omitNulls
[ "id" .= petId
, "category" .= petCategory
, "name" .= petName
, "photoUrls" .= petPhotoUrls
, "tags" .= petTags
, "status" .= petStatus
]
mkPet
:: Text
-> [Text]
-> Pet
mkPet petName petPhotoUrls =
Pet
{ petId = Nothing
, petCategory = Nothing
, petName
, petPhotoUrls
, petTags = Nothing
, petStatus = Nothing
}
data ReadOnlyFirst = ReadOnlyFirst
{ readOnlyFirstBar :: !(Maybe Text)
, readOnlyFirstBaz :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON ReadOnlyFirst where
parseJSON = A.withObject "ReadOnlyFirst" $ \o ->
ReadOnlyFirst
<$> (o .:? "bar")
<*> (o .:? "baz")
instance A.ToJSON ReadOnlyFirst where
toJSON ReadOnlyFirst {..} =
_omitNulls
[ "bar" .= readOnlyFirstBar
, "baz" .= readOnlyFirstBaz
]
mkReadOnlyFirst
:: ReadOnlyFirst
mkReadOnlyFirst =
ReadOnlyFirst
{ readOnlyFirstBar = Nothing
, readOnlyFirstBaz = Nothing
}
data SpecialModelName = SpecialModelName
{ specialModelNameSpecialPropertyName :: !(Maybe Integer)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON SpecialModelName where
parseJSON = A.withObject "SpecialModelName" $ \o ->
SpecialModelName
<$> (o .:? "$special[property.name]")
instance A.ToJSON SpecialModelName where
toJSON SpecialModelName {..} =
_omitNulls
[ "$special[property.name]" .= specialModelNameSpecialPropertyName
]
mkSpecialModelName
:: SpecialModelName
mkSpecialModelName =
SpecialModelName
{ specialModelNameSpecialPropertyName = Nothing
}
data Tag = Tag
{ tagId :: !(Maybe Integer)
, tagName :: !(Maybe Text)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON Tag where
parseJSON = A.withObject "Tag" $ \o ->
Tag
<$> (o .:? "id")
<*> (o .:? "name")
instance A.ToJSON Tag where
toJSON Tag {..} =
_omitNulls
[ "id" .= tagId
, "name" .= tagName
]
mkTag
:: Tag
mkTag =
Tag
{ tagId = Nothing
, tagName = Nothing
}
data TypeHolderDefault = TypeHolderDefault
{ typeHolderDefaultStringItem :: !(Text)
, typeHolderDefaultNumberItem :: !(Double)
, typeHolderDefaultIntegerItem :: !(Int)
, typeHolderDefaultBoolItem :: !(Bool)
, typeHolderDefaultArrayItem :: !([Int])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON TypeHolderDefault where
parseJSON = A.withObject "TypeHolderDefault" $ \o ->
TypeHolderDefault
<$> (o .: "string_item")
<*> (o .: "number_item")
<*> (o .: "integer_item")
<*> (o .: "bool_item")
<*> (o .: "array_item")
instance A.ToJSON TypeHolderDefault where
toJSON TypeHolderDefault {..} =
_omitNulls
[ "string_item" .= typeHolderDefaultStringItem
, "number_item" .= typeHolderDefaultNumberItem
, "integer_item" .= typeHolderDefaultIntegerItem
, "bool_item" .= typeHolderDefaultBoolItem
, "array_item" .= typeHolderDefaultArrayItem
]
mkTypeHolderDefault
:: Text
-> Double
-> Int
-> Bool
-> [Int]
-> TypeHolderDefault
mkTypeHolderDefault typeHolderDefaultStringItem typeHolderDefaultNumberItem typeHolderDefaultIntegerItem typeHolderDefaultBoolItem typeHolderDefaultArrayItem =
TypeHolderDefault
{ typeHolderDefaultStringItem
, typeHolderDefaultNumberItem
, typeHolderDefaultIntegerItem
, typeHolderDefaultBoolItem
, typeHolderDefaultArrayItem
}
data TypeHolderExample = TypeHolderExample
{ typeHolderExampleStringItem :: !(Text)
, typeHolderExampleNumberItem :: !(Double)
, typeHolderExampleIntegerItem :: !(Int)
, typeHolderExampleBoolItem :: !(Bool)
, typeHolderExampleArrayItem :: !([Int])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON TypeHolderExample where
parseJSON = A.withObject "TypeHolderExample" $ \o ->
TypeHolderExample
<$> (o .: "string_item")
<*> (o .: "number_item")
<*> (o .: "integer_item")
<*> (o .: "bool_item")
<*> (o .: "array_item")
instance A.ToJSON TypeHolderExample where
toJSON TypeHolderExample {..} =
_omitNulls
[ "string_item" .= typeHolderExampleStringItem
, "number_item" .= typeHolderExampleNumberItem
, "integer_item" .= typeHolderExampleIntegerItem
, "bool_item" .= typeHolderExampleBoolItem
, "array_item" .= typeHolderExampleArrayItem
]
mkTypeHolderExample
:: Text
-> Double
-> Int
-> Bool
-> [Int]
-> TypeHolderExample
mkTypeHolderExample typeHolderExampleStringItem typeHolderExampleNumberItem typeHolderExampleIntegerItem typeHolderExampleBoolItem typeHolderExampleArrayItem =
TypeHolderExample
{ typeHolderExampleStringItem
, typeHolderExampleNumberItem
, typeHolderExampleIntegerItem
, typeHolderExampleBoolItem
, typeHolderExampleArrayItem
}
data User = User
{ userId :: !(Maybe Integer)
, userUsername :: !(Maybe Text)
, userFirstName :: !(Maybe Text)
, userLastName :: !(Maybe Text)
, userEmail :: !(Maybe Text)
, userPassword :: !(Maybe Text)
, userPhone :: !(Maybe Text)
, userUserStatus :: !(Maybe Int)
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON User where
parseJSON = A.withObject "User" $ \o ->
User
<$> (o .:? "id")
<*> (o .:? "username")
<*> (o .:? "firstName")
<*> (o .:? "lastName")
<*> (o .:? "email")
<*> (o .:? "password")
<*> (o .:? "phone")
<*> (o .:? "userStatus")
instance A.ToJSON User where
toJSON User {..} =
_omitNulls
[ "id" .= userId
, "username" .= userUsername
, "firstName" .= userFirstName
, "lastName" .= userLastName
, "email" .= userEmail
, "password" .= userPassword
, "phone" .= userPhone
, "userStatus" .= userUserStatus
]
mkUser
:: User
mkUser =
User
{ userId = Nothing
, userUsername = Nothing
, userFirstName = Nothing
, userLastName = Nothing
, userEmail = Nothing
, userPassword = Nothing
, userPhone = Nothing
, userUserStatus = Nothing
}
data XmlItem = XmlItem
{ xmlItemAttributeString :: !(Maybe Text)
, xmlItemAttributeNumber :: !(Maybe Double)
, xmlItemAttributeInteger :: !(Maybe Int)
, xmlItemAttributeBoolean :: !(Maybe Bool)
, xmlItemWrappedArray :: !(Maybe [Int])
, xmlItemNameString :: !(Maybe Text)
, xmlItemNameNumber :: !(Maybe Double)
, xmlItemNameInteger :: !(Maybe Int)
, xmlItemNameBoolean :: !(Maybe Bool)
, xmlItemNameArray :: !(Maybe [Int])
, xmlItemNameWrappedArray :: !(Maybe [Int])
, xmlItemPrefixString :: !(Maybe Text)
, xmlItemPrefixNumber :: !(Maybe Double)
, xmlItemPrefixInteger :: !(Maybe Int)
, xmlItemPrefixBoolean :: !(Maybe Bool)
, xmlItemPrefixArray :: !(Maybe [Int])
, xmlItemPrefixWrappedArray :: !(Maybe [Int])
, xmlItemNamespaceString :: !(Maybe Text)
, xmlItemNamespaceNumber :: !(Maybe Double)
, xmlItemNamespaceInteger :: !(Maybe Int)
, xmlItemNamespaceBoolean :: !(Maybe Bool)
, xmlItemNamespaceArray :: !(Maybe [Int])
, xmlItemNamespaceWrappedArray :: !(Maybe [Int])
, xmlItemPrefixNsString :: !(Maybe Text)
, xmlItemPrefixNsNumber :: !(Maybe Double)
, xmlItemPrefixNsInteger :: !(Maybe Int)
, xmlItemPrefixNsBoolean :: !(Maybe Bool)
, xmlItemPrefixNsArray :: !(Maybe [Int])
, xmlItemPrefixNsWrappedArray :: !(Maybe [Int])
} deriving (P.Show, P.Eq, P.Typeable)
instance A.FromJSON XmlItem where
parseJSON = A.withObject "XmlItem" $ \o ->
XmlItem
<$> (o .:? "attribute_string")
<*> (o .:? "attribute_number")
<*> (o .:? "attribute_integer")
<*> (o .:? "attribute_boolean")
<*> (o .:? "wrapped_array")
<*> (o .:? "name_string")
<*> (o .:? "name_number")
<*> (o .:? "name_integer")
<*> (o .:? "name_boolean")
<*> (o .:? "name_array")
<*> (o .:? "name_wrapped_array")
<*> (o .:? "prefix_string")
<*> (o .:? "prefix_number")
<*> (o .:? "prefix_integer")
<*> (o .:? "prefix_boolean")
<*> (o .:? "prefix_array")
<*> (o .:? "prefix_wrapped_array")
<*> (o .:? "namespace_string")
<*> (o .:? "namespace_number")
<*> (o .:? "namespace_integer")
<*> (o .:? "namespace_boolean")
<*> (o .:? "namespace_array")
<*> (o .:? "namespace_wrapped_array")
<*> (o .:? "prefix_ns_string")
<*> (o .:? "prefix_ns_number")
<*> (o .:? "prefix_ns_integer")
<*> (o .:? "prefix_ns_boolean")
<*> (o .:? "prefix_ns_array")
<*> (o .:? "prefix_ns_wrapped_array")
instance A.ToJSON XmlItem where
toJSON XmlItem {..} =
_omitNulls
[ "attribute_string" .= xmlItemAttributeString
, "attribute_number" .= xmlItemAttributeNumber
, "attribute_integer" .= xmlItemAttributeInteger
, "attribute_boolean" .= xmlItemAttributeBoolean
, "wrapped_array" .= xmlItemWrappedArray
, "name_string" .= xmlItemNameString
, "name_number" .= xmlItemNameNumber
, "name_integer" .= xmlItemNameInteger
, "name_boolean" .= xmlItemNameBoolean
, "name_array" .= xmlItemNameArray
, "name_wrapped_array" .= xmlItemNameWrappedArray
, "prefix_string" .= xmlItemPrefixString
, "prefix_number" .= xmlItemPrefixNumber
, "prefix_integer" .= xmlItemPrefixInteger
, "prefix_boolean" .= xmlItemPrefixBoolean
, "prefix_array" .= xmlItemPrefixArray
, "prefix_wrapped_array" .= xmlItemPrefixWrappedArray
, "namespace_string" .= xmlItemNamespaceString
, "namespace_number" .= xmlItemNamespaceNumber
, "namespace_integer" .= xmlItemNamespaceInteger
, "namespace_boolean" .= xmlItemNamespaceBoolean
, "namespace_array" .= xmlItemNamespaceArray
, "namespace_wrapped_array" .= xmlItemNamespaceWrappedArray
, "prefix_ns_string" .= xmlItemPrefixNsString
, "prefix_ns_number" .= xmlItemPrefixNsNumber
, "prefix_ns_integer" .= xmlItemPrefixNsInteger
, "prefix_ns_boolean" .= xmlItemPrefixNsBoolean
, "prefix_ns_array" .= xmlItemPrefixNsArray
, "prefix_ns_wrapped_array" .= xmlItemPrefixNsWrappedArray
]
mkXmlItem
:: XmlItem
mkXmlItem =
XmlItem
{ xmlItemAttributeString = Nothing
, xmlItemAttributeNumber = Nothing
, xmlItemAttributeInteger = Nothing
, xmlItemAttributeBoolean = Nothing
, xmlItemWrappedArray = Nothing
, xmlItemNameString = Nothing
, xmlItemNameNumber = Nothing
, xmlItemNameInteger = Nothing
, xmlItemNameBoolean = Nothing
, xmlItemNameArray = Nothing
, xmlItemNameWrappedArray = Nothing
, xmlItemPrefixString = Nothing
, xmlItemPrefixNumber = Nothing
, xmlItemPrefixInteger = Nothing
, xmlItemPrefixBoolean = Nothing
, xmlItemPrefixArray = Nothing
, xmlItemPrefixWrappedArray = Nothing
, xmlItemNamespaceString = Nothing
, xmlItemNamespaceNumber = Nothing
, xmlItemNamespaceInteger = Nothing
, xmlItemNamespaceBoolean = Nothing
, xmlItemNamespaceArray = Nothing
, xmlItemNamespaceWrappedArray = Nothing
, xmlItemPrefixNsString = Nothing
, xmlItemPrefixNsNumber = Nothing
, xmlItemPrefixNsInteger = Nothing
, xmlItemPrefixNsBoolean = Nothing
, xmlItemPrefixNsArray = Nothing
, xmlItemPrefixNsWrappedArray = Nothing
}
data E'ArrayEnum
= E'ArrayEnum'Fish
| E'ArrayEnum'Crab
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'ArrayEnum where toJSON = A.toJSON . fromE'ArrayEnum
instance A.FromJSON E'ArrayEnum where parseJSON o = P.either P.fail (pure . P.id) . toE'ArrayEnum =<< A.parseJSON o
instance WH.ToHttpApiData E'ArrayEnum where toQueryParam = WH.toQueryParam . fromE'ArrayEnum
instance WH.FromHttpApiData E'ArrayEnum where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'ArrayEnum
instance MimeRender MimeMultipartFormData E'ArrayEnum where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'ArrayEnum :: E'ArrayEnum -> Text
fromE'ArrayEnum = \case
E'ArrayEnum'Fish -> "fish"
E'ArrayEnum'Crab -> "crab"
toE'ArrayEnum :: Text -> P.Either String E'ArrayEnum
toE'ArrayEnum = \case
"fish" -> P.Right E'ArrayEnum'Fish
"crab" -> P.Right E'ArrayEnum'Crab
s -> P.Left $ "toE'ArrayEnum: enum parse failure: " P.++ P.show s
data E'EnumFormString
= E'EnumFormString'_abc
| E'EnumFormString'_efg
| E'EnumFormString'_xyz
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'EnumFormString where toJSON = A.toJSON . fromE'EnumFormString
instance A.FromJSON E'EnumFormString where parseJSON o = P.either P.fail (pure . P.id) . toE'EnumFormString =<< A.parseJSON o
instance WH.ToHttpApiData E'EnumFormString where toQueryParam = WH.toQueryParam . fromE'EnumFormString
instance WH.FromHttpApiData E'EnumFormString where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'EnumFormString
instance MimeRender MimeMultipartFormData E'EnumFormString where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'EnumFormString :: E'EnumFormString -> Text
fromE'EnumFormString = \case
E'EnumFormString'_abc -> "_abc"
E'EnumFormString'_efg -> "-efg"
E'EnumFormString'_xyz -> "(xyz)"
toE'EnumFormString :: Text -> P.Either String E'EnumFormString
toE'EnumFormString = \case
"_abc" -> P.Right E'EnumFormString'_abc
"-efg" -> P.Right E'EnumFormString'_efg
"(xyz)" -> P.Right E'EnumFormString'_xyz
s -> P.Left $ "toE'EnumFormString: enum parse failure: " P.++ P.show s
data E'EnumFormStringArray
= E'EnumFormStringArray'GreaterThan
| E'EnumFormStringArray'Dollar
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'EnumFormStringArray where toJSON = A.toJSON . fromE'EnumFormStringArray
instance A.FromJSON E'EnumFormStringArray where parseJSON o = P.either P.fail (pure . P.id) . toE'EnumFormStringArray =<< A.parseJSON o
instance WH.ToHttpApiData E'EnumFormStringArray where toQueryParam = WH.toQueryParam . fromE'EnumFormStringArray
instance WH.FromHttpApiData E'EnumFormStringArray where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'EnumFormStringArray
instance MimeRender MimeMultipartFormData E'EnumFormStringArray where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'EnumFormStringArray :: E'EnumFormStringArray -> Text
fromE'EnumFormStringArray = \case
E'EnumFormStringArray'GreaterThan -> ">"
E'EnumFormStringArray'Dollar -> "$"
toE'EnumFormStringArray :: Text -> P.Either String E'EnumFormStringArray
toE'EnumFormStringArray = \case
">" -> P.Right E'EnumFormStringArray'GreaterThan
"$" -> P.Right E'EnumFormStringArray'Dollar
s -> P.Left $ "toE'EnumFormStringArray: enum parse failure: " P.++ P.show s
data E'EnumInteger
= E'EnumInteger'Num1
| E'EnumInteger'NumMinus_1
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'EnumInteger where toJSON = A.toJSON . fromE'EnumInteger
instance A.FromJSON E'EnumInteger where parseJSON o = P.either P.fail (pure . P.id) . toE'EnumInteger =<< A.parseJSON o
instance WH.ToHttpApiData E'EnumInteger where toQueryParam = WH.toQueryParam . fromE'EnumInteger
instance WH.FromHttpApiData E'EnumInteger where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'EnumInteger
instance MimeRender MimeMultipartFormData E'EnumInteger where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'EnumInteger :: E'EnumInteger -> Int
fromE'EnumInteger = \case
E'EnumInteger'Num1 -> 1
E'EnumInteger'NumMinus_1 -> -1
toE'EnumInteger :: Int -> P.Either String E'EnumInteger
toE'EnumInteger = \case
1 -> P.Right E'EnumInteger'Num1
-1 -> P.Right E'EnumInteger'NumMinus_1
s -> P.Left $ "toE'EnumInteger: enum parse failure: " P.++ P.show s
data E'EnumNumber
= E'EnumNumber'Num1_Dot_1
| E'EnumNumber'NumMinus_1_Dot_2
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'EnumNumber where toJSON = A.toJSON . fromE'EnumNumber
instance A.FromJSON E'EnumNumber where parseJSON o = P.either P.fail (pure . P.id) . toE'EnumNumber =<< A.parseJSON o
instance WH.ToHttpApiData E'EnumNumber where toQueryParam = WH.toQueryParam . fromE'EnumNumber
instance WH.FromHttpApiData E'EnumNumber where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'EnumNumber
instance MimeRender MimeMultipartFormData E'EnumNumber where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'EnumNumber :: E'EnumNumber -> Double
fromE'EnumNumber = \case
E'EnumNumber'Num1_Dot_1 -> 1.1
E'EnumNumber'NumMinus_1_Dot_2 -> -1.2
toE'EnumNumber :: Double -> P.Either String E'EnumNumber
toE'EnumNumber = \case
1.1 -> P.Right E'EnumNumber'Num1_Dot_1
-1.2 -> P.Right E'EnumNumber'NumMinus_1_Dot_2
s -> P.Left $ "toE'EnumNumber: enum parse failure: " P.++ P.show s
data E'EnumQueryInteger
= E'EnumQueryInteger'Num1
| E'EnumQueryInteger'NumMinus_2
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'EnumQueryInteger where toJSON = A.toJSON . fromE'EnumQueryInteger
instance A.FromJSON E'EnumQueryInteger where parseJSON o = P.either P.fail (pure . P.id) . toE'EnumQueryInteger =<< A.parseJSON o
instance WH.ToHttpApiData E'EnumQueryInteger where toQueryParam = WH.toQueryParam . fromE'EnumQueryInteger
instance WH.FromHttpApiData E'EnumQueryInteger where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'EnumQueryInteger
instance MimeRender MimeMultipartFormData E'EnumQueryInteger where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'EnumQueryInteger :: E'EnumQueryInteger -> Int
fromE'EnumQueryInteger = \case
E'EnumQueryInteger'Num1 -> 1
E'EnumQueryInteger'NumMinus_2 -> -2
toE'EnumQueryInteger :: Int -> P.Either String E'EnumQueryInteger
toE'EnumQueryInteger = \case
1 -> P.Right E'EnumQueryInteger'Num1
-2 -> P.Right E'EnumQueryInteger'NumMinus_2
s -> P.Left $ "toE'EnumQueryInteger: enum parse failure: " P.++ P.show s
data E'EnumString
= E'EnumString'UPPER
| E'EnumString'Lower
| E'EnumString'Empty
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'EnumString where toJSON = A.toJSON . fromE'EnumString
instance A.FromJSON E'EnumString where parseJSON o = P.either P.fail (pure . P.id) . toE'EnumString =<< A.parseJSON o
instance WH.ToHttpApiData E'EnumString where toQueryParam = WH.toQueryParam . fromE'EnumString
instance WH.FromHttpApiData E'EnumString where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'EnumString
instance MimeRender MimeMultipartFormData E'EnumString where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'EnumString :: E'EnumString -> Text
fromE'EnumString = \case
E'EnumString'UPPER -> "UPPER"
E'EnumString'Lower -> "lower"
E'EnumString'Empty -> ""
toE'EnumString :: Text -> P.Either String E'EnumString
toE'EnumString = \case
"UPPER" -> P.Right E'EnumString'UPPER
"lower" -> P.Right E'EnumString'Lower
"" -> P.Right E'EnumString'Empty
s -> P.Left $ "toE'EnumString: enum parse failure: " P.++ P.show s
data E'Inner
= E'Inner'UPPER
| E'Inner'Lower
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'Inner where toJSON = A.toJSON . fromE'Inner
instance A.FromJSON E'Inner where parseJSON o = P.either P.fail (pure . P.id) . toE'Inner =<< A.parseJSON o
instance WH.ToHttpApiData E'Inner where toQueryParam = WH.toQueryParam . fromE'Inner
instance WH.FromHttpApiData E'Inner where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'Inner
instance MimeRender MimeMultipartFormData E'Inner where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'Inner :: E'Inner -> Text
fromE'Inner = \case
E'Inner'UPPER -> "UPPER"
E'Inner'Lower -> "lower"
toE'Inner :: Text -> P.Either String E'Inner
toE'Inner = \case
"UPPER" -> P.Right E'Inner'UPPER
"lower" -> P.Right E'Inner'Lower
s -> P.Left $ "toE'Inner: enum parse failure: " P.++ P.show s
data E'JustSymbol
= E'JustSymbol'Greater_Than_Or_Equal_To
| E'JustSymbol'Dollar
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'JustSymbol where toJSON = A.toJSON . fromE'JustSymbol
instance A.FromJSON E'JustSymbol where parseJSON o = P.either P.fail (pure . P.id) . toE'JustSymbol =<< A.parseJSON o
instance WH.ToHttpApiData E'JustSymbol where toQueryParam = WH.toQueryParam . fromE'JustSymbol
instance WH.FromHttpApiData E'JustSymbol where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'JustSymbol
instance MimeRender MimeMultipartFormData E'JustSymbol where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'JustSymbol :: E'JustSymbol -> Text
fromE'JustSymbol = \case
E'JustSymbol'Greater_Than_Or_Equal_To -> ">="
E'JustSymbol'Dollar -> "$"
toE'JustSymbol :: Text -> P.Either String E'JustSymbol
toE'JustSymbol = \case
">=" -> P.Right E'JustSymbol'Greater_Than_Or_Equal_To
"$" -> P.Right E'JustSymbol'Dollar
s -> P.Left $ "toE'JustSymbol: enum parse failure: " P.++ P.show s
data E'Status
= E'Status'Placed
| E'Status'Approved
| E'Status'Delivered
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'Status where toJSON = A.toJSON . fromE'Status
instance A.FromJSON E'Status where parseJSON o = P.either P.fail (pure . P.id) . toE'Status =<< A.parseJSON o
instance WH.ToHttpApiData E'Status where toQueryParam = WH.toQueryParam . fromE'Status
instance WH.FromHttpApiData E'Status where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'Status
instance MimeRender MimeMultipartFormData E'Status where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'Status :: E'Status -> Text
fromE'Status = \case
E'Status'Placed -> "placed"
E'Status'Approved -> "approved"
E'Status'Delivered -> "delivered"
toE'Status :: Text -> P.Either String E'Status
toE'Status = \case
"placed" -> P.Right E'Status'Placed
"approved" -> P.Right E'Status'Approved
"delivered" -> P.Right E'Status'Delivered
s -> P.Left $ "toE'Status: enum parse failure: " P.++ P.show s
data E'Status2
= E'Status2'Available
| E'Status2'Pending
| E'Status2'Sold
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON E'Status2 where toJSON = A.toJSON . fromE'Status2
instance A.FromJSON E'Status2 where parseJSON o = P.either P.fail (pure . P.id) . toE'Status2 =<< A.parseJSON o
instance WH.ToHttpApiData E'Status2 where toQueryParam = WH.toQueryParam . fromE'Status2
instance WH.FromHttpApiData E'Status2 where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'Status2
instance MimeRender MimeMultipartFormData E'Status2 where mimeRender _ = mimeRenderDefaultMultipartFormData
fromE'Status2 :: E'Status2 -> Text
fromE'Status2 = \case
E'Status2'Available -> "available"
E'Status2'Pending -> "pending"
E'Status2'Sold -> "sold"
toE'Status2 :: Text -> P.Either String E'Status2
toE'Status2 = \case
"available" -> P.Right E'Status2'Available
"pending" -> P.Right E'Status2'Pending
"sold" -> P.Right E'Status2'Sold
s -> P.Left $ "toE'Status2: enum parse failure: " P.++ P.show s
data EnumClass
= EnumClass'_abc
| EnumClass'_efg
| EnumClass'_xyz
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON EnumClass where toJSON = A.toJSON . fromEnumClass
instance A.FromJSON EnumClass where parseJSON o = P.either P.fail (pure . P.id) . toEnumClass =<< A.parseJSON o
instance WH.ToHttpApiData EnumClass where toQueryParam = WH.toQueryParam . fromEnumClass
instance WH.FromHttpApiData EnumClass where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toEnumClass
instance MimeRender MimeMultipartFormData EnumClass where mimeRender _ = mimeRenderDefaultMultipartFormData
fromEnumClass :: EnumClass -> Text
fromEnumClass = \case
EnumClass'_abc -> "_abc"
EnumClass'_efg -> "-efg"
EnumClass'_xyz -> "(xyz)"
toEnumClass :: Text -> P.Either String EnumClass
toEnumClass = \case
"_abc" -> P.Right EnumClass'_abc
"-efg" -> P.Right EnumClass'_efg
"(xyz)" -> P.Right EnumClass'_xyz
s -> P.Left $ "toEnumClass: enum parse failure: " P.++ P.show s
data OuterEnum
= OuterEnum'Placed
| OuterEnum'Approved
| OuterEnum'Delivered
deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum)
instance A.ToJSON OuterEnum where toJSON = A.toJSON . fromOuterEnum
instance A.FromJSON OuterEnum where parseJSON o = P.either P.fail (pure . P.id) . toOuterEnum =<< A.parseJSON o
instance WH.ToHttpApiData OuterEnum where toQueryParam = WH.toQueryParam . fromOuterEnum
instance WH.FromHttpApiData OuterEnum where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toOuterEnum
instance MimeRender MimeMultipartFormData OuterEnum where mimeRender _ = mimeRenderDefaultMultipartFormData
fromOuterEnum :: OuterEnum -> Text
fromOuterEnum = \case
OuterEnum'Placed -> "placed"
OuterEnum'Approved -> "approved"
OuterEnum'Delivered -> "delivered"
toOuterEnum :: Text -> P.Either String OuterEnum
toOuterEnum = \case
"placed" -> P.Right OuterEnum'Placed
"approved" -> P.Right OuterEnum'Approved
"delivered" -> P.Right OuterEnum'Delivered
s -> P.Left $ "toOuterEnum: enum parse failure: " P.++ P.show s
data AuthApiKeyApiKey =
AuthApiKeyApiKey Text
deriving (P.Eq, P.Show, P.Typeable)
instance AuthMethod AuthApiKeyApiKey where
applyAuthMethod _ a@(AuthApiKeyApiKey secret) req =
P.pure $
if (P.typeOf a `P.elem` rAuthTypes req)
then req `setHeader` toHeader ("api_key", secret)
& L.over rAuthTypesL (P.filter (/= P.typeOf a))
else req
data AuthApiKeyApiKeyQuery =
AuthApiKeyApiKeyQuery Text
deriving (P.Eq, P.Show, P.Typeable)
instance AuthMethod AuthApiKeyApiKeyQuery where
applyAuthMethod _ a@(AuthApiKeyApiKeyQuery secret) req =
P.pure $
if (P.typeOf a `P.elem` rAuthTypes req)
then req `setQuery` toQuery ("api_key_query", Just secret)
& L.over rAuthTypesL (P.filter (/= P.typeOf a))
else req
data AuthBasicHttpBasicTest =
AuthBasicHttpBasicTest B.ByteString B.ByteString
deriving (P.Eq, P.Show, P.Typeable)
instance AuthMethod AuthBasicHttpBasicTest where
applyAuthMethod _ a@(AuthBasicHttpBasicTest user pw) req =
P.pure $
if (P.typeOf a `P.elem` rAuthTypes req)
then req `setHeader` toHeader ("Authorization", T.decodeUtf8 cred)
& L.over rAuthTypesL (P.filter (/= P.typeOf a))
else req
where cred = BC.append "Basic " (B64.encode $ BC.concat [ user, ":", pw ])
data AuthOAuthPetstoreAuth =
AuthOAuthPetstoreAuth Text
deriving (P.Eq, P.Show, P.Typeable)
instance AuthMethod AuthOAuthPetstoreAuth where
applyAuthMethod _ a@(AuthOAuthPetstoreAuth secret) req =
P.pure $
if (P.typeOf a `P.elem` rAuthTypes req)
then req `setHeader` toHeader ("Authorization", "Bearer " <> secret)
& L.over rAuthTypesL (P.filter (/= P.typeOf a))
else req