{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE NoImplicitPrelude #-} module Data.Morpheus.Client.Internal.Types ( ClientTypeDefinition (..), RequestTypeDefinition (..), FetchError (..), SchemaSource (..), ExecutableSource, GQLClientResult, ClientDeclaration (..), DERIVING_MODE (..), ) where import Data.ByteString.Lazy (ByteString) import Data.Morpheus.CodeGen.Internal.AST ( CodeGenConstructor (..), CodeGenType, CodeGenTypeName, ) import Data.Morpheus.Types.Internal.AST ( GQLErrors, OperationType, TypeKind, TypeName, ) import Relude hiding (ByteString) data DERIVING_MODE = SCALAR_MODE | ENUM_MODE | TYPE_MODE data ClientDeclaration = ToJSONClass DERIVING_MODE CodeGenType | FromJSONClass DERIVING_MODE CodeGenType | RequestTypeClass RequestTypeDefinition | ClientType CodeGenType data ClientTypeDefinition = ClientTypeDefinition { ClientTypeDefinition -> CodeGenTypeName clientTypeName :: CodeGenTypeName, ClientTypeDefinition -> [CodeGenConstructor] clientCons :: [CodeGenConstructor], ClientTypeDefinition -> TypeKind clientKind :: TypeKind } deriving (Int -> ClientTypeDefinition -> ShowS [ClientTypeDefinition] -> ShowS ClientTypeDefinition -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [ClientTypeDefinition] -> ShowS $cshowList :: [ClientTypeDefinition] -> ShowS show :: ClientTypeDefinition -> String $cshow :: ClientTypeDefinition -> String showsPrec :: Int -> ClientTypeDefinition -> ShowS $cshowsPrec :: Int -> ClientTypeDefinition -> ShowS Show) data RequestTypeDefinition = RequestTypeDefinition { RequestTypeDefinition -> TypeName requestName :: TypeName, RequestTypeDefinition -> TypeName requestArgs :: TypeName, RequestTypeDefinition -> OperationType requestType :: OperationType, RequestTypeDefinition -> String requestQuery :: String } deriving (Int -> RequestTypeDefinition -> ShowS [RequestTypeDefinition] -> ShowS RequestTypeDefinition -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [RequestTypeDefinition] -> ShowS $cshowList :: [RequestTypeDefinition] -> ShowS show :: RequestTypeDefinition -> String $cshow :: RequestTypeDefinition -> String showsPrec :: Int -> RequestTypeDefinition -> ShowS $cshowsPrec :: Int -> RequestTypeDefinition -> ShowS Show) data FetchError a = FetchErrorParseFailure String | FetchErrorProducedErrors GQLErrors (Maybe a) | FetchErrorNoResult deriving (Int -> FetchError a -> ShowS forall a. Show a => Int -> FetchError a -> ShowS forall a. Show a => [FetchError a] -> ShowS forall a. Show a => FetchError a -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [FetchError a] -> ShowS $cshowList :: forall a. Show a => [FetchError a] -> ShowS show :: FetchError a -> String $cshow :: forall a. Show a => FetchError a -> String showsPrec :: Int -> FetchError a -> ShowS $cshowsPrec :: forall a. Show a => Int -> FetchError a -> ShowS Show, FetchError a -> FetchError a -> Bool forall a. Eq a => FetchError a -> FetchError a -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: FetchError a -> FetchError a -> Bool $c/= :: forall a. Eq a => FetchError a -> FetchError a -> Bool == :: FetchError a -> FetchError a -> Bool $c== :: forall a. Eq a => FetchError a -> FetchError a -> Bool Eq, forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a forall a x. Rep (FetchError a) x -> FetchError a forall a x. FetchError a -> Rep (FetchError a) x $cto :: forall a x. Rep (FetchError a) x -> FetchError a $cfrom :: forall a x. FetchError a -> Rep (FetchError a) x Generic) data SchemaSource = JSON ByteString | GQL ByteString deriving (Int -> SchemaSource -> ShowS [SchemaSource] -> ShowS SchemaSource -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [SchemaSource] -> ShowS $cshowList :: [SchemaSource] -> ShowS show :: SchemaSource -> String $cshow :: SchemaSource -> String showsPrec :: Int -> SchemaSource -> ShowS $cshowsPrec :: Int -> SchemaSource -> ShowS Show, SchemaSource -> SchemaSource -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: SchemaSource -> SchemaSource -> Bool $c/= :: SchemaSource -> SchemaSource -> Bool == :: SchemaSource -> SchemaSource -> Bool $c== :: SchemaSource -> SchemaSource -> Bool Eq) type ExecutableSource = Text type GQLClientResult (a :: Type) = (Either (FetchError a) a)