{-# LANGUAGE TemplateHaskell #-}
module Galley.Effects.FederatorAccess
(
FederatorAccess (..),
runFederated,
runFederatedEither,
runFederatedConcurrently,
runFederatedConcurrentlyEither,
runFederatedConcurrentlyBucketsEither,
isFederationConfigured,
)
where
import Data.Qualified
import Imports
import Polysemy
import Wire.API.Federation.Client
import Wire.API.Federation.Component
import Wire.API.Federation.Error
data FederatorAccess m a where
RunFederated ::
(KnownComponent c) =>
Remote x ->
FederatorClient c a ->
FederatorAccess m a
RunFederatedEither ::
(KnownComponent c) =>
Remote x ->
FederatorClient c a ->
FederatorAccess m (Either FederationError a)
RunFederatedConcurrently ::
(KnownComponent c, Foldable f, Functor f) =>
f (Remote x) ->
(Remote [x] -> FederatorClient c a) ->
FederatorAccess m [Remote a]
RunFederatedConcurrentlyEither ::
forall (c :: Component) f a m x.
(KnownComponent c, Foldable f, Functor f) =>
f (Remote x) ->
(Remote [x] -> FederatorClient c a) ->
FederatorAccess m [Either (Remote [x], FederationError) (Remote a)]
RunFederatedConcurrentlyBucketsEither ::
forall (c :: Component) f a m x.
(KnownComponent c, Foldable f) =>
f (Remote x) ->
(Remote x -> FederatorClient c a) ->
FederatorAccess m [Either (Remote x, FederationError) (Remote a)]
IsFederationConfigured :: FederatorAccess m Bool
makeSem ''FederatorAccess