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 ...@@ -48,7 +48,7 @@ getMetadataScroll q scroll scrollId page = do
case eRes of case eRes of
Left err -> pure $ Left err Left err -> pure $ Left err
Right res@(ScrollResponse { .. }) -> do Right res@(ScrollResponse { .. }) -> do
eDocs <- getMetadataScroll q scroll (Just _scroll_scrollId) (page + 1) eDocs <- getMetadataScroll q scroll _scroll_scrollId (page + 1)
case eDocs of case eDocs of
Left err -> pure $ Left err Left err -> pure $ Left err
Right docs -> pure $ Right $ _scroll_documents <> docs Right docs -> pure $ Right $ _scroll_documents <> docs
...@@ -68,7 +68,7 @@ getMetadataScrollProgress q scroll scrollId progress errorHandler = do ...@@ -68,7 +68,7 @@ getMetadataScrollProgress q scroll scrollId progress errorHandler = do
, _scroll_nextScrollURI , _scroll_nextScrollURI
, _scroll_scrollId }) -> do , _scroll_scrollId }) -> do
progress res progress res
getMetadataScrollProgress q scroll (Just _scroll_scrollId) progress errorHandler getMetadataScrollProgress q scroll _scroll_scrollId progress errorHandler
type Query = Text type Query = Text
......
...@@ -91,17 +91,18 @@ instance Monoid Documents where ...@@ -91,17 +91,18 @@ instance Monoid Documents where
data ScrollResponse = ScrollResponse data ScrollResponse = ScrollResponse
{ _scroll_documents :: Documents { _scroll_documents :: Documents
, _scroll_noMoreScrollResults :: Bool , _scroll_noMoreScrollResults :: Maybe Bool
, _scroll_nextScrollURI :: T.Text , _scroll_nextScrollURI :: Maybe T.Text
, _scroll_scrollId :: T.Text } , _scroll_scrollId :: Maybe T.Text }
L.makeLenses ''ScrollResponse L.makeLenses ''ScrollResponse
instance FromJSON ScrollResponse where instance FromJSON ScrollResponse where
parseJSON (Object o) = do parseJSON (Object o) = do
_documents_total <- o .: "total" _documents_total <- o .: "total"
_documents_hits <- o .: "hits" _documents_hits <- o .: "hits"
_scroll_noMoreScrollResults <- o .: "noMoreScrollResults" _scroll_noMoreScrollResults <- o .:? "noMoreScrollResults"
_scroll_nextScrollURI <- o .: "nextScrollURI" _scroll_nextScrollURI <- o .:? "nextScrollURI"
_scroll_scrollId <- o .: "scrollId" _scroll_scrollId <- o .:? "scrollId"
pure $ ScrollResponse { _scroll_documents = Documents { .. } 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