Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christian Merten
haskell-gargantext
Commits
a11c6b4d
Commit
a11c6b4d
authored
Jul 22, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[list] added v3 CSV upload endpoint
NOTE: This is a copy of uploadAPI, i.e. it parses JSON currently.
parent
e841d483
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
List.hs
src/Gargantext/API/Ngrams/List.hs
+34
-2
No files found.
src/Gargantext/API/Ngrams/List.hs
View file @
a11c6b4d
...
...
@@ -58,9 +58,10 @@ import qualified Data.Text as Text
type
API
=
Get
'[
J
SON
,
HTML
]
(
Headers
'[
H
eader
"Content-Disposition"
Text
]
NgramsList
)
-- :<|> ReqBody '[JSON] NgramsList :> Post '[JSON] Bool
:<|>
PostAPI
:<|>
CSVPostAPI
api
::
ListId
->
GargServer
API
api
l
=
get
l
:<|>
postAsync
l
api
l
=
get
l
:<|>
postAsync
l
:<|>
csvPostAsync
l
data
HTML
instance
Accept
HTML
where
...
...
@@ -164,7 +165,6 @@ toIndexedNgrams m t = Indexed <$> i <*> n
i
=
HashMap
.
lookup
t
m
n
=
Just
(
text2ngrams
t
)
------------------------------------------------------------------------
------------------------------------------------------------------------
type
PostAPI
=
Summary
"Update List"
:>
"add"
...
...
@@ -196,6 +196,38 @@ postAsync' l (WithFile _ m _) logStatus = do
,
_scst_remaining
=
Just
0
,
_scst_events
=
Just
[]
}
------------------------------------------------------------------------
type
CSVPostAPI
=
Summary
"Update List (legacy v3 CSV)"
:>
"csv"
:>
"form"
:>
"async"
:>
AsyncJobs
JobLog
'[
F
ormUrlEncoded
]
WithFile
JobLog
csvPostAsync
::
ListId
->
GargServer
PostAPI
csvPostAsync
lId
=
serveJobsAPI
$
JobFunction
(
\
f
log'
->
csvPostAsync'
lId
f
(
liftBase
.
log'
))
csvPostAsync'
::
FlowCmdM
env
err
m
=>
ListId
->
WithFile
->
(
JobLog
->
m
()
)
->
m
JobLog
csvPostAsync'
l
(
WithFile
_
m
_
)
logStatus
=
do
logStatus
JobLog
{
_scst_succeeded
=
Just
0
,
_scst_failed
=
Just
0
,
_scst_remaining
=
Just
1
,
_scst_events
=
Just
[]
}
_r
<-
post
l
m
pure
JobLog
{
_scst_succeeded
=
Just
1
,
_scst_failed
=
Just
0
,
_scst_remaining
=
Just
0
,
_scst_events
=
Just
[]
}
------------------------------------------------------------------------
data
WithFile
=
WithFile
{
_wf_filetype
::
!
FileType
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment