mirror of
https://github.com/bsima/haskell-urbit-api.git
synced 2024-09-11 18:27:08 +03:00
fix request json - apparently it needs to be an array, not an object
This commit is contained in:
parent
d39506bd3c
commit
f952351191
@ -86,14 +86,15 @@ poke sess ship shipName app mark json =
|
|||||||
sess
|
sess
|
||||||
(channelUrl ship)
|
(channelUrl ship)
|
||||||
$ Aeson.toJSON $
|
$ Aeson.toJSON $
|
||||||
Aeson.object
|
[ Aeson.object
|
||||||
[ "id" .= nextEventId ship,
|
[ "id" .= nextEventId ship,
|
||||||
"action" .= Text.pack "poke",
|
"action" .= Text.pack "poke",
|
||||||
"ship" .= shipName,
|
"ship" .= shipName,
|
||||||
"app" .= app,
|
"app" .= app,
|
||||||
"mark" .= mark,
|
"mark" .= mark,
|
||||||
"json" .= json
|
"json" .= json
|
||||||
]
|
]
|
||||||
|
]
|
||||||
|
|
||||||
-- | Acknowledge receipt of a message. (This clears it from the ship's queue.)
|
-- | Acknowledge receipt of a message. (This clears it from the ship's queue.)
|
||||||
ack :: Session.Session -> Ship -> Int -> IO (Wreq.Response L.ByteString)
|
ack :: Session.Session -> Ship -> Int -> IO (Wreq.Response L.ByteString)
|
||||||
@ -102,10 +103,11 @@ ack sess ship eventId =
|
|||||||
sess
|
sess
|
||||||
(channelUrl ship)
|
(channelUrl ship)
|
||||||
$ Aeson.toJSON $
|
$ Aeson.toJSON $
|
||||||
Aeson.object
|
[ Aeson.object
|
||||||
[ "action" .= Text.pack "ack",
|
[ "action" .= Text.pack "ack",
|
||||||
"event-id" .= eventId
|
"event-id" .= eventId
|
||||||
]
|
]
|
||||||
|
]
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
subscribe :: Ship -> Path -> OutputStream ByteString -> IO ()
|
subscribe :: Ship -> Path -> OutputStream ByteString -> IO ()
|
||||||
|
2
test.hs
2
test.hs
@ -46,7 +46,7 @@ main = do
|
|||||||
"number" .= (1 :: Int), -- FIXME: should this be lastEventId?
|
"number" .= (1 :: Int), -- FIXME: should this be lastEventId?
|
||||||
"author" .= Text.pack "~zod",
|
"author" .= Text.pack "~zod",
|
||||||
"when" .= (1602118786225 :: Int),
|
"when" .= (1602118786225 :: Int),
|
||||||
"letter" .= Aeson.object ["text" .= Text.pack "hello world!"]
|
"letter" .= Aeson.object ["text" .= Text.pack "hello world from haskell!"]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user