define API client functions
This commit is contained in:
parent
8faa9dc016
commit
20e51ecca4
|
@ -29,9 +29,12 @@ import Data.Time.Clock.POSIX
|
|||
import Data.Typeable (Typeable)
|
||||
import qualified Network.HTTP.Client as HTTP
|
||||
import System.Random
|
||||
import Text.Read (readEither)
|
||||
|
||||
import qualified Network.Wai.Handler.Warp as Warp
|
||||
import Servant
|
||||
import Servant.Client
|
||||
import Servant.Server
|
||||
|
||||
import Hash2Pub.FediChordTypes
|
||||
import Hash2Pub.RingMap
|
||||
|
@ -260,6 +263,14 @@ tagUnsubscribe serv hashtag origin = do
|
|||
liftIO . atomically $ deleteSubscription (subscribers serv) hashtag (BSU.toString $ HTTP.host req, HTTP.port req)
|
||||
pure "bye bye"
|
||||
|
||||
-- client/ request functions
|
||||
|
||||
clientAPI :: Proxy PostServiceAPI
|
||||
clientAPI = Proxy
|
||||
|
||||
|
||||
relayInboxClient :<|> subscriptionDeliveryClient :<|> postFetchClient :<|> postMultiFetchClient :<|> postInboxClient :<|> tagDeliveryClient :<|> tagSubscribeClient :<|> tagUnsubscribeClient = client clientAPI
|
||||
|
||||
-- ======= data structure manipulations =========
|
||||
|
||||
-- | Write all pending posts of a subscriber-tag-combination to its queue.
|
||||
|
@ -350,6 +361,8 @@ normaliseTag = Txt.fromStrict . normalize NFC . Txt.toStrict
|
|||
instance {-# OVERLAPPABLE #-} Show a => MimeRender PlainText a where
|
||||
mimeRender _ = BSUL.fromString . show
|
||||
|
||||
instance {-# OVERLAPPABLE #-} Read a => MimeUnrender PlainText a where
|
||||
mimeUnrender _ = readEither . BSUL.toString
|
||||
|
||||
-- ====== worker threads ======
|
||||
|
||||
|
|
Loading…
Reference in a new issue