mirror of
https://github.com/bsima/haskell-urbit-api.git
synced 2024-08-17 22:10:55 +03:00
remove hardcoded channel uid, sseClient field
This commit is contained in:
parent
f952351191
commit
6732cffcbc
@ -20,6 +20,7 @@ import qualified Data.ByteString.Char8 as Char8
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as Text
|
||||
import Data.UUID.V4 as UUID
|
||||
import Network.Http.Client as Client
|
||||
import Network.Wreq (FormParam ((:=)))
|
||||
import qualified Network.Wreq as Wreq
|
||||
@ -36,17 +37,16 @@ data Ship = Ship
|
||||
name :: ShipName,
|
||||
-- | Track the latest event we saw (needed for poking).
|
||||
lastEventId :: Int,
|
||||
-- | Internet-facing access point, like 'http://sampel-palnet.arvo.network'
|
||||
-- | Network access point, with port if necessary. Like
|
||||
-- 'https://sampel-palnet.arvo.network', or 'http://localhost:8080'.
|
||||
url :: Url,
|
||||
-- | Login code, `+code` in the dojo. Don't share this publically.
|
||||
code :: Text,
|
||||
-- | Not implemented yet...
|
||||
sseClient :: Bool
|
||||
code :: Text
|
||||
}
|
||||
deriving (Show)
|
||||
|
||||
channelUrl :: Ship -> String
|
||||
channelUrl Ship {url} = url <> "/~/channel/1234567890abcdef"
|
||||
channelUrl Ship {url, uid} = url <> "/~/channel/" <> Text.unpack uid
|
||||
|
||||
type Url = String
|
||||
|
||||
|
5
test.hs
5
test.hs
@ -57,7 +57,6 @@ main = do
|
||||
r <- ack sess ship 1
|
||||
return $ r ^? Wreq.responseBody
|
||||
|
||||
|
||||
fakezod :: String -> Ship
|
||||
fakezod port =
|
||||
Ship
|
||||
@ -65,11 +64,9 @@ fakezod port =
|
||||
name = "zod",
|
||||
lastEventId = 1,
|
||||
url = "http://localhost:" ++ port,
|
||||
code = "lidlut-tabwed-pillex-ridrup",
|
||||
sseClient = False
|
||||
code = "lidlut-tabwed-pillex-ridrup"
|
||||
}
|
||||
|
||||
|
||||
-- | Poor man's testing framework
|
||||
testing :: Text -> IO Bool -> IO ()
|
||||
testing description f =
|
||||
|
Loading…
Reference in New Issue
Block a user