Module

GraphQL.Client.BaseClients.Apollo

Package
purescript-graphql-client
Repository
OxfordAbstracts/purescript-graphql-client

Creates GraphQL Apollo clients

#ApolloClientOptions Source

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

#ApolloSubClientOptions Source

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

#ApolloClient Source

data ApolloClient

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

Instances

#ApolloSubClient Source

data ApolloSubClient

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

Instances

#MutationOpts Source

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

Instances

#createClient Source

#createSubscriptionClient Source

#IsApollo Source

class IsApollo :: forall k. k -> Constraintclass IsApollo cl 

Instances

#updateCacheJson Source

updateCacheJson :: forall s directives m q qSchema c res sr. IsApollo c => GqlQuery directives OpQuery qSchema q res => EncodeJson res => DecodeJson res => (Client c { directives :: Proxy directives, query :: qSchema | sr }) -> q -> (res -> res) -> Effect Unit

#updateCache Source

updateCache :: forall c directives qSchema q m s res sr. IsApollo c => GqlQuery directives OpQuery qSchema q res => (res -> Json) -> (Json -> Either JsonDecodeError res) -> (Client c { directives :: Proxy directives, query :: qSchema | sr }) -> q -> (res -> res) -> Effect Unit

#readQuery Source

readQuery :: forall c directives qSchema q m s res sr. IsApollo c => GqlQuery directives OpQuery qSchema q res => (Json -> Either JsonDecodeError res) -> (Client c { directives :: Proxy directives, query :: qSchema | sr }) -> q -> Effect (Maybe res)

read a query result from the cache

#writeQuery Source

writeQuery :: forall c directives qSchema q m s res sr. IsApollo c => GqlQuery directives OpQuery qSchema q res => (res -> Json) -> (Client c { directives :: Proxy directives, query :: qSchema | sr }) -> q -> res -> Effect Unit

write a query result to the cache