gribouille / elm-graphql / GraphQL

An easy-to-use GraphQL library.

Types


type alias Response a =
Result Http.Error (Res a)

GraphQL response type spec.


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

GraphQL error type spec.


type Path
    = PathKey String
    | PathItem Basics.Int

Path of the response field which experienced the error.


type QLRes a
    = ResHttpError Http.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 Http.Header, url : String, root : String, decoder : Json.Decode.Decoder a, variables : Maybe Json.Decode.Value, on : Response a -> msg } -> Platform.Cmd.Cmd msg

Run a GraphQL request.

segment : Response a -> QLRes a

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