This module provides helpers to directly deal with HTTP with GraphQL.
{ url : String
, headers : List Http.Header
}
Defines all the options for a GraphQl request.
send : Options -> (Result Http.Error c -> msg) -> Json.Decode.Decoder c -> GraphQl.Request a b -> Platform.Cmd.Cmd msg
Send a GraphQL request directly through an HTTP post, directly decoding the
data
field in the response.
graphQlRequestOptions : GraphQl.Options
graphQlRequestOptions =
{ url = "/example_endpoint"
, headers = []
}
sendMyAwesomeRequest : (Result Http.Error a -> msg) -> Decoder a -> Cmd msg
sendMyAwesomeRequest msg decoder =
GraphQl.query myAwesomeRequest
|> GraphQl.Http.send graphQlRequestOptions msg decoder