Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype GQLExecDoc = GQLExecDoc {
- unGQLExecDoc :: [ExecutableDefinition Name]
- newtype OperationName = OperationName {
- _unOperationName :: Name
- 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 {
- _unGQLQueryText :: Text
- 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
- encodeGQErr :: Bool -> QErr -> Value
- type GQResult a = Either GQExecError a
- newtype GQExecError = GQExecError [Value]
- type GQResponse = GQResult ByteString
- isExecError :: GQResult a -> Bool
- encodeGQResp :: GQResponse -> EncJSON
- decodeGQResp :: EncJSON -> (Maybe GQResponse, EncJSON)
- encodeHTTPResp :: GQResponse -> EncJSON
Documentation
newtype GQLExecDoc Source #
GQLExecDoc | |
|
Instances
newtype OperationName Source #
OperationName | |
|
Instances
type VariableValues = HashMap Name Value Source #
https://graphql.org/learn/serving-over-http/#post-request
See GQLReqParsed
for invariants.
GQLReq | |
|
Instances
data GQLBatchedReqs a Source #
Batched queries are sent as a JSON array of
GQLReq
records. This newtype exists to support
the unusual JSON encoding.
Instances
newtype GQLQueryText Source #
GQLQueryText | |
|
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
_grOperationName
isNothing
,_grQuery
contains exactly oneExecutableDefinitionOperation
(and zero or moreExecutableDefinitionFragment
) - when
_grOperationName
is present, there is a correspondingExecutableDefinitionOperation
in_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 #
encodeGQErr :: Bool -> QErr -> Value Source #
type GQResult a = Either GQExecError a Source #
newtype GQExecError Source #
GQExecError [Value] |
Instances
Eq GQExecError Source # | |
Defined in Hasura.GraphQL.Transport.HTTP.Protocol (==) :: GQExecError -> GQExecError -> Bool # (/=) :: GQExecError -> GQExecError -> Bool # | |
Show GQExecError Source # | |
Defined in Hasura.GraphQL.Transport.HTTP.Protocol showsPrec :: Int -> GQExecError -> ShowS # show :: GQExecError -> String # showList :: [GQExecError] -> ShowS # | |
ToJSON GQExecError Source # | |
Defined in Hasura.GraphQL.Transport.HTTP.Protocol toJSON :: GQExecError -> Value toEncoding :: GQExecError -> Encoding toJSONList :: [GQExecError] -> Value toEncodingList :: [GQExecError] -> Encoding |
type GQResponse = GQResult ByteString Source #
isExecError :: GQResult a -> Bool Source #
encodeGQResp :: GQResponse -> EncJSON Source #
decodeGQResp :: EncJSON -> (Maybe GQResponse, EncJSON) Source #
encodeHTTPResp :: GQResponse -> EncJSON Source #