Module

GraphQL.Client.BaseClients.Apollo

Creates GraphQL Apollo clients

#ApolloClientOptions

type ApolloClientOptions = { authToken :: Maybe String, headers :: Array RequestHeader, url :: URL }

#ApolloSubClientOptions

type ApolloSubClientOptions = { authToken :: Maybe String, headers :: Array RequestHeader, url :: URL, websocketUrl :: URL }

#ApolloClient

data ApolloClient :: Type

Apollo client to make graphQL queries and mutations. From the @apollo/client npm module

Instances

#ApolloSubClient

data ApolloSubClient :: Type

Apollo client to make graphQL queries, mutations and subscriptions. Requires a web socket graphQL server. From the @apollo/client npm module

Instances

#MutationOpts

type MutationOpts = { errorPolicy :: ErrorPolicy, optimisticResponse :: Maybe Json, refetchQueries :: Array String, update :: Maybe (Effect Unit) }

Instances

#createClient

createClient :: forall querySchema mutationSchema subscriptionSchema. ApolloClientOptions -> Effect (Client ApolloClient querySchema mutationSchema subscriptionSchema)

#createSubscriptionClient

createSubscriptionClient :: forall querySchema mutationSchema subscriptionSchema. ApolloSubClientOptions -> Effect (Client ApolloSubClient querySchema mutationSchema subscriptionSchema)

#updateCacheJson

updateCacheJson :: forall s m q qSchema c res. IsApollo c => GqlQuery qSchema q res => EncodeJson res => DecodeJson res => Client c qSchema m s -> q -> (res -> res) -> Effect Unit

#updateCache

updateCache :: forall c qSchema q m s res. IsApollo c => GqlQuery qSchema q res => (res -> Json) -> (Json -> Either JsonDecodeError res) -> (Client c qSchema m s) -> q -> (res -> res) -> Effect Unit

#readQuery

readQuery :: forall c qSchema q m s res. IsApollo c => GqlQuery qSchema q res => (Json -> Either JsonDecodeError res) -> (Client c qSchema m s) -> q -> Effect (Maybe res)

read a query result from the cache

#writeQuery

writeQuery :: forall c qSchema q m s res. IsApollo c => GqlQuery qSchema q res => (res -> Json) -> (Client c qSchema m s) -> q -> res -> Effect Unit

write a query result to the cache

Modules