| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Hasura.GraphQL.Transport.HTTP.Protocol
Synopsis
- newtype GQLExecDoc = GQLExecDoc {}
- newtype OperationName = OperationName {}
- type VariableValues = HashMap Name Value
- data GQLReq a = GQLReq {- _grOperationName :: !(Maybe OperationName)
- _grQuery :: !a
- _grVariables :: !(Maybe VariableValues)
 
- data GQLBatchedReqs a- = GQLSingleRequest a
- | GQLBatchedReqs [a]
 
- newtype GQLQueryText = GQLQueryText {}
- type GQLReqUnparsed = GQLReq GQLQueryText
- type GQLReqParsed = GQLReq GQLExecDoc
- type ReqsText = GQLBatchedReqs (GQLReq GQLQueryText)
- type GQLReqOutgoing = GQLReq SingleOperation
- type SingleOperation = TypedOperationDefinition NoFragments Name
- renderGQLReqOutgoing :: GQLReqOutgoing -> GQLReqUnparsed
- getSingleOperation :: MonadError QErr m => GQLReqParsed -> m SingleOperation
- toParsed :: MonadError QErr m => GQLReqUnparsed -> m GQLReqParsed
- getOpNameFromParsedReq :: GQLReqParsed -> Maybe OperationName
- encodeGQErr :: Bool -> QErr -> Encoding
- type GQResult a = Either GQExecError a
- newtype GQExecError = GQExecError [Encoding]
- type GQResponse = GQResult ByteString
- isExecError :: GQResult a -> Bool
- encodeGQExecError :: GQExecError -> Encoding
- encodeGQResp :: GQResponse -> EncJSON
- decodeGQResp :: EncJSON -> (Maybe GQResponse, EncJSON)
- encodeHTTPResp :: GQResponse -> EncJSON
Documentation
newtype GQLExecDoc Source #
Constructors
| GQLExecDoc | |
| Fields | |
Instances
newtype OperationName Source #
Constructors
| OperationName | |
| Fields | |
Instances
https://graphql.org/learn/serving-over-http/#post-request
See GQLReqParsed for invariants.
Constructors
| GQLReq | |
| Fields 
 | |
Instances
| Functor GQLReq Source # | |
| Lift a => Lift (GQLReq a :: Type) Source # | |
| FromJSON a => FromJSON (GQLReq a) Source # | |
| ToJSON a => ToJSON (GQLReq a) Source # | |
| Generic (GQLReq a) Source # | |
| Show a => Show (GQLReq a) Source # | |
| Eq a => Eq (GQLReq a) Source # | |
| Hashable a => Hashable (GQLReq a) Source # | |
| type Rep (GQLReq a) Source # | |
| Defined in Hasura.GraphQL.Transport.HTTP.Protocol type Rep (GQLReq a) = D1 ('MetaData "GQLReq" "Hasura.GraphQL.Transport.HTTP.Protocol" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "GQLReq" 'PrefixI 'True) (S1 ('MetaSel ('Just "_grOperationName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe OperationName)) :*: (S1 ('MetaSel ('Just "_grQuery") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Just "_grVariables") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe VariableValues))))) | |
data GQLBatchedReqs a Source #
Batched queries are sent as a JSON array of
 GQLReq records. This newtype exists to support
 the unusual JSON encoding.
Constructors
| GQLSingleRequest a | |
| GQLBatchedReqs [a] | 
Instances
newtype GQLQueryText Source #
Constructors
| GQLQueryText | |
| Fields | |
Instances
type GQLReqUnparsed = GQLReq GQLQueryText Source #
We've not yet parsed the graphql query string parameter of the POST.
type GQLReqParsed = GQLReq GQLExecDoc Source #
Invariants:
- when _grOperationNameisNothing,_grQuerycontains exactly oneExecutableDefinitionOperation(and zero or moreExecutableDefinitionFragment)
- when _grOperationNameis present, there is a correspondingExecutableDefinitionOperationin_grQuery
type ReqsText = GQLBatchedReqs (GQLReq GQLQueryText) Source #
type GQLReqOutgoing = GQLReq SingleOperation Source #
A simplified form of GQLReqParsed which is more ergonomic in particular
 for APIs that act as graphql clients (e.g. in remote relationship
 execution). This is a "desugared" request in which fragments have been
 inlined (see inlineSelectionSet), and the operation (_grOperationName)
 to be executed is the only payload (in contrast to a ExecutableDocument
 with possibly many named operations).
_grOperationName is essentially ignored here, but should correspond with
 _todName if present.
These could maybe benefit from an HKD refactoring.
type SingleOperation = TypedOperationDefinition NoFragments Name Source #
A single graphql operation to be executed, with fragment definitions
 inlined. This is the simplified form of GQLExecDoc or
 ExecutableDocument:
getSingleOperation :: MonadError QErr m => GQLReqParsed -> m SingleOperation Source #
Obtain the actual single operation to be executed, from the possibly- multi-operation document, validating per the spec and inlining any fragment definitions (pre-defined parts of a graphql query) at fragment spreads (locations where fragments are "spliced"). See:
https://spec.graphql.org/June2018/#sec-Executable-Definitions and... https://graphql.org/learn/serving-over-http/
toParsed :: MonadError QErr m => GQLReqUnparsed -> m GQLReqParsed Source #
getOpNameFromParsedReq :: GQLReqParsed -> Maybe OperationName Source #
Get operation name from parsed executable document if the field operationName is not explicitly
 sent by the client in the body of the request
type GQResult a = Either GQExecError a Source #
newtype GQExecError Source #
Constructors
| GQExecError [Encoding] | 
Instances
| Show GQExecError Source # | |
| Defined in Hasura.GraphQL.Transport.HTTP.Protocol Methods showsPrec :: Int -> GQExecError -> ShowS # show :: GQExecError -> String # showList :: [GQExecError] -> ShowS # | |
| Eq GQExecError Source # | |
| Defined in Hasura.GraphQL.Transport.HTTP.Protocol | |
type GQResponse = GQResult ByteString Source #
isExecError :: GQResult a -> Bool Source #
encodeGQResp :: GQResponse -> EncJSON Source #
decodeGQResp :: EncJSON -> (Maybe GQResponse, EncJSON) Source #
encodeHTTPResp :: GQResponse -> EncJSON Source #