mirror of
https://github.com/bsima/haskell-urbit-api.git
synced 2024-09-11 18:27:08 +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 qualified Data.ByteString.Lazy as L
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
|
import Data.UUID.V4 as UUID
|
||||||
import Network.Http.Client as Client
|
import Network.Http.Client as Client
|
||||||
import Network.Wreq (FormParam ((:=)))
|
import Network.Wreq (FormParam ((:=)))
|
||||||
import qualified Network.Wreq as Wreq
|
import qualified Network.Wreq as Wreq
|
||||||
@ -36,17 +37,16 @@ data Ship = Ship
|
|||||||
name :: ShipName,
|
name :: ShipName,
|
||||||
-- | Track the latest event we saw (needed for poking).
|
-- | Track the latest event we saw (needed for poking).
|
||||||
lastEventId :: Int,
|
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,
|
url :: Url,
|
||||||
-- | Login code, `+code` in the dojo. Don't share this publically.
|
-- | Login code, `+code` in the dojo. Don't share this publically.
|
||||||
code :: Text,
|
code :: Text
|
||||||
-- | Not implemented yet...
|
|
||||||
sseClient :: Bool
|
|
||||||
}
|
}
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
channelUrl :: Ship -> String
|
channelUrl :: Ship -> String
|
||||||
channelUrl Ship {url} = url <> "/~/channel/1234567890abcdef"
|
channelUrl Ship {url, uid} = url <> "/~/channel/" <> Text.unpack uid
|
||||||
|
|
||||||
type Url = String
|
type Url = String
|
||||||
|
|
||||||
|
5
test.hs
5
test.hs
@ -57,7 +57,6 @@ main = do
|
|||||||
r <- ack sess ship 1
|
r <- ack sess ship 1
|
||||||
return $ r ^? Wreq.responseBody
|
return $ r ^? Wreq.responseBody
|
||||||
|
|
||||||
|
|
||||||
fakezod :: String -> Ship
|
fakezod :: String -> Ship
|
||||||
fakezod port =
|
fakezod port =
|
||||||
Ship
|
Ship
|
||||||
@ -65,11 +64,9 @@ fakezod port =
|
|||||||
name = "zod",
|
name = "zod",
|
||||||
lastEventId = 1,
|
lastEventId = 1,
|
||||||
url = "http://localhost:" ++ port,
|
url = "http://localhost:" ++ port,
|
||||||
code = "lidlut-tabwed-pillex-ridrup",
|
code = "lidlut-tabwed-pillex-ridrup"
|
||||||
sseClient = False
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- | Poor man's testing framework
|
-- | Poor man's testing framework
|
||||||
testing :: Text -> IO Bool -> IO ()
|
testing :: Text -> IO Bool -> IO ()
|
||||||
testing description f =
|
testing description f =
|
||||||
|
Loading…
Reference in New Issue
Block a user