Commit 6821f416 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] IsTex API with Maybe parameters

parent b12e7618
......@@ -48,7 +48,7 @@ getMetadataScroll q scroll scrollId page = do
case eRes of
Left err -> pure $ Left err
Right res@(ScrollResponse { .. }) -> do
eDocs <- getMetadataScroll q scroll (Just _scroll_scrollId) (page + 1)
eDocs <- getMetadataScroll q scroll _scroll_scrollId (page + 1)
case eDocs of
Left err -> pure $ Left err
Right docs -> pure $ Right $ _scroll_documents <> docs
......@@ -68,7 +68,7 @@ getMetadataScrollProgress q scroll scrollId progress errorHandler = do
, _scroll_nextScrollURI
, _scroll_scrollId }) -> do
progress res
getMetadataScrollProgress q scroll (Just _scroll_scrollId) progress errorHandler
getMetadataScrollProgress q scroll _scroll_scrollId progress errorHandler
type Query = Text
......
......@@ -91,17 +91,18 @@ instance Monoid Documents where
data ScrollResponse = ScrollResponse
{ _scroll_documents :: Documents
, _scroll_noMoreScrollResults :: Bool
, _scroll_nextScrollURI :: T.Text
, _scroll_scrollId :: T.Text }
, _scroll_noMoreScrollResults :: Maybe Bool
, _scroll_nextScrollURI :: Maybe T.Text
, _scroll_scrollId :: Maybe T.Text }
L.makeLenses ''ScrollResponse
instance FromJSON ScrollResponse where
parseJSON (Object o) = do
_documents_total <- o .: "total"
_documents_hits <- o .: "hits"
_scroll_noMoreScrollResults <- o .: "noMoreScrollResults"
_scroll_nextScrollURI <- o .: "nextScrollURI"
_scroll_scrollId <- o .: "scrollId"
_documents_total <- o .: "total"
_documents_hits <- o .: "hits"
_scroll_noMoreScrollResults <- o .:? "noMoreScrollResults"
_scroll_nextScrollURI <- o .:? "nextScrollURI"
_scroll_scrollId <- o .:? "scrollId"
pure $ ScrollResponse { _scroll_documents = Documents { .. }
, .. }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment