jamesmacaulay/elm-graphql/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

GraphQL.Client.Http

The functions in this module let you perform HTTP requests to conventional GraphQL server endpoints.

type Error
= HttpError Error
| GraphQLError (List RequestError)

Represents errors that can occur when sending a GraphQL request over HTTP.

type alias RequestError =
{ message : String
, locations : List DocumentLocation
}

An error returned by the GraphQL server that indicates there was something wrong with the request.

type alias DocumentLocation =
{ line : Int
, column : Int
}

A location in a GraphQL request document.

sendQuery : String -> Request Query result -> Task Error result

Takes a URL and a Query Request and returns a Task that you can perform with Task.attempt which will send the request to a GraphQL server at the given endpoint.

sendMutation : String -> Request Mutation result -> Task Error result

Takes a URL and a Mutation Request and returns a Task that you can perform with Task.attempt which will send the request to a GraphQL server at the given endpoint.