gribouille/elm-graphql/2.0.0

NOTE: the latest version is 2.0.2

GraphQL

An easy-to-use GraphQL library.

Types

type alias Response a =
Result Error (Res a)

GraphQL response type spec.

type alias Error =
{ message : String
, locations : Maybe (List Location)
, path : Maybe (List Path)
, extensions : Maybe (Dict String Value)
}

GraphQL error type spec.

type Path
= PathKey String
| PathItem Int

Path of the response field which experienced the error.

type QLRes a
= ResHttpError Error
| ResOnlyErrors (List Error)
| ResWithErrors (List Error) a
| ResWithoutError a

Type to expose several GraphQL response scenari.

type alias Res a =
{ data : Maybe (Root a)
, errors : Maybe (List Error)
}

GraphQL data type spec.

type alias Root a =
{ root : a }

Root data response.

Functions

run :
{ query : String
, headers : List Header
, url : String
, root : String
, decoder : Decoder a
, variables : Maybe Value
, on : Response a -> msg
}
-> Cmd msg

Run a GraphQL request.

segment : Response a -> QLRes a

Convert a raw Graph Response to the more expressive type QLRes.