mirror of
https://github.com/bsima/haskell-urbit-api.git
synced 2024-08-17 22:10:55 +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
|
||||
(channelUrl ship)
|
||||
$ Aeson.toJSON $
|
||||
Aeson.object
|
||||
[ "id" .= nextEventId ship,
|
||||
"action" .= Text.pack "poke",
|
||||
"ship" .= shipName,
|
||||
"app" .= app,
|
||||
"mark" .= mark,
|
||||
"json" .= json
|
||||
]
|
||||
[ Aeson.object
|
||||
[ "id" .= nextEventId ship,
|
||||
"action" .= Text.pack "poke",
|
||||
"ship" .= shipName,
|
||||
"app" .= app,
|
||||
"mark" .= mark,
|
||||
"json" .= json
|
||||
]
|
||||
]
|
||||
|
||||
-- | Acknowledge receipt of a message. (This clears it from the ship's queue.)
|
||||
ack :: Session.Session -> Ship -> Int -> IO (Wreq.Response L.ByteString)
|
||||
@ -102,10 +103,11 @@ ack sess ship eventId =
|
||||
sess
|
||||
(channelUrl ship)
|
||||
$ Aeson.toJSON $
|
||||
Aeson.object
|
||||
[ "action" .= Text.pack "ack",
|
||||
"event-id" .= eventId
|
||||
]
|
||||
[ Aeson.object
|
||||
[ "action" .= Text.pack "ack",
|
||||
"event-id" .= eventId
|
||||
]
|
||||
]
|
||||
|
||||
-- |
|
||||
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?
|
||||
"author" .= Text.pack "~zod",
|
||||
"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