primait/elm-graphql-client/1.0.1

NOTE: the latest version is 1.1.0

GraphqlClient.Client

This is a Graphql client with automatic retry

Model name decodesTo msg
-> List Authentication
-> (Model name decodesTo msg -> model -> model)
-> model
-> ( model, Cmd msg )

funzione da chiamare quando il chiamante è riuscito a recuperare un nuovo token Questa funzione triggera l'esecuzione di tutte le query che erano fallite fino a questo punto ed erano rimaste in attesa di nuova autenticazione I parametri sono:

  • the component model
  • a list of headers (name: String, value: String)
  • a closure to updater the caller model with the component model. Something like (\gqlClientModel -> {model | gqlClientModel = gqlClientModel})
  • the caller model
Msg name decodesTo
-> Model name decodesTo msg
-> Cmd msg
-> (model -> name -> decodesTo -> ( model, Cmd msg ))
-> (model -> name -> Error decodesTo -> model)
-> (Model name decodesTo msg -> model -> model)
-> model
-> ( model, Cmd msg )

HOF che permette il wiring di un componente GqlClient con il chiamante. Va messo nell'Update del chiamante dove si ricevono i messaggi del componente La sua funzione principale è quella di evitare che il chiamante debba ricordare tutti i dettagli implementativi di integrazione, con il rischio di dimenticarsi dei pezzi

I parametri sono:

  • the component message
  • the component model
  • the caller Cmd Msg to get a new header
  • a closure to handle the result of an OK query. The closure should accept the caller model and a decoder for the response
  • a closure to handle the result of an Error query. The closure should accept the caller model and a Graphql.Http.Error
  • a closure to updater the caller model with the component model. Something like (\gqlClientModel -> {model | gqlClientModel = gqlClientModel})
  • the caller model
name
-> List Authentication
-> Model name decodesTo msg
-> SelectionSet decodesTo RootMutation
-> ( Model name decodesTo msg, Cmd (Msg name decodesTo) )

funzione che permette di eseguire una mutation graphql ritorna una tupla con il modello aggiornato del client (da inserire nel modello del chiamante) e il comando da eseguire. Il comando va ovviamente passato al runtime elm

I parametri sono:

  • the mutation name
  • a list of headers (name: String, value: String)
  • the component model
  • the selection set of the query that will be executed
name
-> List Authentication
-> Model name decodesTo msg
-> SelectionSet decodesTo RootQuery
-> ( Model name decodesTo msg, Cmd (Msg name decodesTo) )

funzione che permette di eseguire una query graphql ritorna una tupla con il modello aggiornato del client (da inserire nel modello del chiamante) e il comando da eseguire. Il comando va ovviamente passato al runtime elm

I parametri sono:

  • the query name
  • a list of headers (name: String, value: String)
  • the component model
  • the selection set of the query that will be executed