Compare commits
No commits in common. "5fedd9f87cdc1c861a1dd645debd82d9698847a4" and "ebc0d54ddc37a7ef8d4b5adf3f1b8ae74f34c4cb" have entirely different histories.
5fedd9f87c
...
ebc0d54ddc
3 changed files with 7 additions and 19 deletions
|
@ -46,7 +46,7 @@ category: Network
|
||||||
extra-source-files: CHANGELOG.md
|
extra-source-files: CHANGELOG.md
|
||||||
|
|
||||||
common deps
|
common deps
|
||||||
build-depends: base ^>=4.12.0.0, containers ^>=0.6.0.1, bytestring, utf8-string ^>=1.0.1.1, network ^>=2.8.0.1, time ^>=1.8.0.2, cmdargs ^>= 0.10, cryptonite ^>= 0.25, memory, async, stm, asn1-encoding, asn1-types, asn1-parse, publicsuffix, network-byte-order, safe, iproute, mtl, random, servant, servant-server, servant-client, warp, text
|
build-depends: base ^>=4.12.0.0, containers ^>=0.6.0.1, bytestring, utf8-string ^>=1.0.1.1, network ^>=2.8.0.1, time ^>=1.8.0.2, cmdargs ^>= 0.10, cryptonite ^>= 0.25, memory, async, stm, asn1-encoding, asn1-types, asn1-parse, publicsuffix, network-byte-order, safe, iproute, mtl, random
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ library
|
||||||
import: deps
|
import: deps
|
||||||
|
|
||||||
-- Modules exported by the library.
|
-- Modules exported by the library.
|
||||||
exposed-modules: Hash2Pub.FediChord, Hash2Pub.FediChordTypes, Hash2Pub.DHTProtocol, Hash2Pub.ASN1Coding, Hash2Pub.ProtocolTypes, Hash2Pub.PostService
|
exposed-modules: Hash2Pub.FediChord, Hash2Pub.FediChordTypes, Hash2Pub.DHTProtocol, Hash2Pub.ASN1Coding, Hash2Pub.ProtocolTypes
|
||||||
|
|
||||||
-- Modules included in this library but not exported.
|
-- Modules included in this library but not exported.
|
||||||
other-modules: Hash2Pub.Utils
|
other-modules: Hash2Pub.Utils
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
{-# LANGUAGE DataKinds #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
|
|
||||||
module Hash2Pub.PostService where
|
|
||||||
|
|
||||||
import Servant
|
|
||||||
import qualified Data.Text as Txt
|
|
||||||
|
|
||||||
type ServiceAPI = "relay" :> "inbox" :> PostCreated '[PlainText] Txt.Text
|
|
||||||
-- ^ delivery endpoint of new posts to relay
|
|
||||||
:<|> "relay" :> "subscribers" :> Post '[PlainText] Txt.Text
|
|
||||||
-- ^ endpoint for delivering the subscription and outstanding queue
|
|
||||||
:<|> "post" :> Capture "postid" Txt.Text :> Get '[PlainText] Txt.Text
|
|
||||||
:<|> "tags" :> Capture "hashtag" Txt.Text :> PostCreated '[PlainText] Txt.Text
|
|
||||||
:<|> "tags" :> Capture "hashtag" Txt.Text :> "subscribe" :> Header "Origin" Txt.Text :> Get '[PlainText] Txt.Text
|
|
||||||
:<|> "tags" :> Capture "hashtag" Txt.Text :> "unsubscribe" :> Header "Origin" Txt.Text :> Get '[PlainText] Txt.Text
|
|
|
@ -4,6 +4,11 @@ module Hash2Pub.Utils where
|
||||||
import qualified Data.ByteString as BS
|
import qualified Data.ByteString as BS
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
|
|
||||||
|
-- |wraps a list into a Maybe, by replacing empty lists with Nothing
|
||||||
|
maybeEmpty :: [a] -> Maybe [a]
|
||||||
|
maybeEmpty [] = Nothing
|
||||||
|
maybeEmpty nonemptyList = Just nonemptyList
|
||||||
|
|
||||||
-- | Chop a list into sublists of i elements. The last sublist might contain
|
-- | Chop a list into sublists of i elements. The last sublist might contain
|
||||||
-- less than i elements.
|
-- less than i elements.
|
||||||
chunksOf :: Int -> [a] -> [[a]]
|
chunksOf :: Int -> [a] -> [[a]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue