Copyright | (c) CNRS 2017-Present |
---|---|
License | AGPL + CECILL v3 |
Maintainer | team@gargantext.org |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- type GETAPI = Summary "Get List" :> ("lists" :> (Capture "listId" ListId :> (("json" :> Get '[JSON, HTML] (Headers '[Header "Content-Disposition" Text] NgramsList)) :<|> (("json.zip" :> Get '[ZIP] (Headers '[Header "Content-Disposition" Text] NgramsListZIP)) :<|> ("csv" :> Get '[CSV] (Headers '[Header "Content-Disposition" Text] NgramsTableMap))))))
- getApi :: GargServer GETAPI
- type JSONAPI = Summary "Update List" :> ("lists" :> (Capture "listId" ListId :> ("add" :> ("form" :> ("async" :> AsyncJobs JobLog '[FormUrlEncoded] WithJsonFile JobLog)))))
- jsonApi :: ServerT JSONAPI (GargM Env BackendInternalError)
- getJson :: HasNodeStory env err m => ListId -> m (Headers '[Header "Content-Disposition" Text] NgramsList)
- getJsonZip :: HasNodeStory env err m => ListId -> m (Headers '[Header "Content-Disposition" Text] NgramsListZIP)
- getCsv :: HasNodeStory env err m => ListId -> m (Headers '[Header "Content-Disposition" Text] NgramsTableMap)
- jsonPostAsync :: ServerT JSONAPI (GargM Env BackendInternalError)
- postAsyncJSON :: (HasNodeStory env err m, MonadJobStatus m) => ListId -> NgramsList -> JobHandle m -> m ()
- type CSVAPI = Summary "Update List (legacy v3 CSV)" :> ("lists" :> (Capture "listId" ListId :> ("csv" :> ("add" :> ("form" :> ("async" :> AsyncJobs JobLog '[FormUrlEncoded] WithTextFile JobLog))))))
- csvApi :: ServerT CSVAPI (GargM Env BackendInternalError)
- csvPostAsync :: ServerT CSVAPI (GargM Env BackendInternalError)
- ngramsListFromCSVData :: Text -> Either String NgramsList
- csvToNgramsTableMap :: Record -> Parser NgramsTableMap
- importCsvFile :: forall env err m. (HasNodeStory env err m, HasServerError err, MonadJobStatus m) => ListId -> FilePath -> m ()
- toIndexedNgrams :: HashMap Text NgramsId -> Text -> Maybe (Indexed Int Ngrams)
Documentation
type GETAPI = Summary "Get List" :> ("lists" :> (Capture "listId" ListId :> (("json" :> Get '[JSON, HTML] (Headers '[Header "Content-Disposition" Text] NgramsList)) :<|> (("json.zip" :> Get '[ZIP] (Headers '[Header "Content-Disposition" Text] NgramsListZIP)) :<|> ("csv" :> Get '[CSV] (Headers '[Header "Content-Disposition" Text] NgramsTableMap)))))) #
getApi :: GargServer GETAPI #
type JSONAPI = Summary "Update List" :> ("lists" :> (Capture "listId" ListId :> ("add" :> ("form" :> ("async" :> AsyncJobs JobLog '[FormUrlEncoded] WithJsonFile JobLog))))) #
getJson :: HasNodeStory env err m => ListId -> m (Headers '[Header "Content-Disposition" Text] NgramsList) #
getJsonZip :: HasNodeStory env err m => ListId -> m (Headers '[Header "Content-Disposition" Text] NgramsListZIP) #
getCsv :: HasNodeStory env err m => ListId -> m (Headers '[Header "Content-Disposition" Text] NgramsTableMap) #
postAsyncJSON :: (HasNodeStory env err m, MonadJobStatus m) => ListId -> NgramsList -> JobHandle m -> m () #
type CSVAPI = Summary "Update List (legacy v3 CSV)" :> ("lists" :> (Capture "listId" ListId :> ("csv" :> ("add" :> ("form" :> ("async" :> AsyncJobs JobLog '[FormUrlEncoded] WithTextFile JobLog)))))) #
ngramsListFromCSVData :: Text -> Either String NgramsList #
Tries converting a text file into an NgramList
, so that we can reuse the
existing JSON endpoint for the CSV upload.
csvToNgramsTableMap :: Record -> Parser NgramsTableMap #
Converts a plain CSV Record
into an NgramsTableMap
importCsvFile :: forall env err m. (HasNodeStory env err m, HasServerError err, MonadJobStatus m) => ListId -> FilePath -> m () #
This is for debugging the CSV parser in the REPL