primait / elm-graphql-client / GraphqlClient.Client

This is a Graphql client with automatic retry

runQuery : name -> List GraphqlClient.Model.Authentication -> GraphqlClient.Model.Model name decodesTo msg -> Graphql.SelectionSet.SelectionSet decodesTo Graphql.Operation.RootQuery -> ( GraphqlClient.Model.Model name decodesTo msg, Platform.Cmd.Cmd (GraphqlClient.Model.Msg name decodesTo) )

Function that execute a Graphql query It return a tuple with the updated internal model (to be inserted in the caller model) and the Cmd to be executed.

The arguments are:

runMutation : name -> List GraphqlClient.Model.Authentication -> GraphqlClient.Model.Model name decodesTo msg -> Graphql.SelectionSet.SelectionSet decodesTo Graphql.Operation.RootMutation -> ( GraphqlClient.Model.Model name decodesTo msg, Platform.Cmd.Cmd (GraphqlClient.Model.Msg name decodesTo) )

Function that execute a Graphql mutation It return a tuple with the updated internal model (to be inserted in the caller model) and the Cmd to be executed.

The arguments are:

authenticationChanged : GraphqlClient.Model.Model name decodesTo msg -> List GraphqlClient.Model.Authentication -> (GraphqlClient.Model.Model name decodesTo msg -> model -> model) -> model -> ( model, Platform.Cmd.Cmd msg )

Function to call when the caller has finished its "job" and it's ready to perform the query/mutation again. If there were queries/mutations in pipeline, that were blocked by an authentication problem, they are all returned as a Cmd to be executed.

The arguments are:

manageUpdate : GraphqlClient.Model.Msg name decodesTo -> GraphqlClient.Model.Model name decodesTo msg -> Platform.Cmd.Cmd msg -> (model -> name -> decodesTo -> ( model, Platform.Cmd.Cmd msg )) -> (model -> name -> Graphql.Http.Error decodesTo -> model) -> (GraphqlClient.Model.Model name decodesTo msg -> model -> model) -> model -> ( model, Platform.Cmd.Cmd msg )

This is a function that simplifies the wiring between the caller and the graphql client component. It should be put inside the caller Update cycle. The main purpose is to make it easier for the caller to remember how the integration should be done, by passing arguments to this function. It is not mandatory for this reason, but highly recommended.

The arguments are: