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 :: Type

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

Instances

#ApolloSubClient Source

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

#createClient Source

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

#createSubscriptionClient Source

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

#updateCacheJson Source

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

#updateCache Source

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

#readQuery Source

readQuery :: forall res s m q qSchema c. 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 Source

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

write a query result to the cache

#watchQuery_ Source

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

#watchQueryOpts Source

watchQueryOpts :: forall res s m q qSchema c. IsApollo c => GqlQuery qSchema q res => (Json -> Either JsonDecodeError res) -> { fetchPolicy :: Maybe FetchPolicy } -> (Client c qSchema m s) -> String -> q -> (Either JsonDecodeError res -> Effect Unit) -> Effect (Effect Unit)

#watchQueryEvent Source

watchQueryEvent :: forall res q s m qSchema c. IsApollo c => GqlQuery qSchema q res => DecodeJson res => Client c qSchema m s -> String -> q -> Event (Either JsonDecodeError res)

#watchQueryEventOpts Source

watchQueryEventOpts :: forall res q s m qSchema c. IsApollo c => GqlQuery qSchema q res => (Json -> Either JsonDecodeError res) -> { fetchPolicy :: Maybe FetchPolicy } -> Client c qSchema m s -> String -> q -> Event (Either JsonDecodeError res)