mirror of
https://github.com/bsima/haskell-urbit-api.git
synced 2024-10-27 02:30:46 +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,7 +86,7 @@ poke sess ship shipName app mark json =
|
||||
sess
|
||||
(channelUrl ship)
|
||||
$ Aeson.toJSON $
|
||||
Aeson.object
|
||||
[ Aeson.object
|
||||
[ "id" .= nextEventId ship,
|
||||
"action" .= Text.pack "poke",
|
||||
"ship" .= shipName,
|
||||
@ -94,6 +94,7 @@ poke sess ship shipName app mark json =
|
||||
"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
|
||||
[ 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