Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
gargantext
crawlers
hal
Commits
ef9e638c
Commit
ef9e638c
authored
Aug 28, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] main function name.
parent
6db3aee2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
Main.hs
app/Main.hs
+3
-4
HAL.hs
src/HAL.hs
+11
-2
No files found.
app/Main.hs
View file @
ef9e638c
...
@@ -6,15 +6,14 @@ import Network.HTTP.Client (newManager)
...
@@ -6,15 +6,14 @@ import Network.HTTP.Client (newManager)
import
Network.HTTP.Client.TLS
(
tlsManagerSettings
)
import
Network.HTTP.Client.TLS
(
tlsManagerSettings
)
import
Servant.Client
import
Servant.Client
import
HAL
(
runSearchRequest
)
import
HAL
(
getMetadataWith
)
import
HAL.Client
import
HAL.Client
import
HAL.Doc
import
HAL.Doc
import
Tree
import
Tree
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
manager'
<-
newManager
tlsManagerSettings
res
<-
getMetadataWith
"artificial intelligence"
(
Just
10
)
res
<-
runSearchRequest
$
[
"ia"
]
case
res
of
case
res
of
(
Left
err
)
->
print
err
(
Left
err
)
->
print
err
(
Right
val
)
->
print
$
_docs
val
(
Right
val
)
->
print
$
_docs
val
src/HAL.hs
View file @
ef9e638c
...
@@ -13,6 +13,15 @@ import Servant.Client (BaseUrl(..), Scheme(..), ClientM, ClientError, runClientM
...
@@ -13,6 +13,15 @@ import Servant.Client (BaseUrl(..), Scheme(..), ClientM, ClientError, runClientM
import
HAL.Client
import
HAL.Client
import
HAL.Doc.Corpus
import
HAL.Doc.Corpus
getMetadataWith
::
Text
->
Maybe
Int
->
IO
(
Either
ClientError
(
Response
Corpus
))
getMetadataWith
q
l
=
do
manager'
<-
newManager
tlsManagerSettings
runHalAPIClient
$
search
(
Just
requestedFields
)
[
q
]
Nothing
l
Nothing
requestedFields
::
Text
requestedFields
=
"docid,title_s,abstract_s,submittedDate_s,source_s,authFullName_s,authOrganism_s"
runHalAPIClient
::
ClientM
(
Response
Corpus
)
->
IO
(
Either
ClientError
(
Response
Corpus
))
runHalAPIClient
::
ClientM
(
Response
Corpus
)
->
IO
(
Either
ClientError
(
Response
Corpus
))
runHalAPIClient
cmd
=
do
runHalAPIClient
cmd
=
do
manager'
<-
newManager
tlsManagerSettings
manager'
<-
newManager
tlsManagerSettings
...
@@ -20,8 +29,8 @@ runHalAPIClient cmd = do
...
@@ -20,8 +29,8 @@ runHalAPIClient cmd = do
runStructureRequest
::
Maybe
Text
->
IO
(
Either
ClientError
(
Response
Corpus
))
runStructureRequest
::
Maybe
Text
->
IO
(
Either
ClientError
(
Response
Corpus
))
runStructureRequest
rq
=
runStructureRequest
rq
=
runHalAPIClient
$
structure
(
Just
"docid,title_s,abstract_s,submittedDate_s,source_s,authFullName_s,authOrganism_s"
)
rq
(
Just
10000
)
runHalAPIClient
$
structure
(
Just
requestedFields
)
rq
(
Just
10000
)
runSearchRequest
::
[
Text
]
->
IO
(
Either
ClientError
(
Response
Corpus
))
runSearchRequest
::
[
Text
]
->
IO
(
Either
ClientError
(
Response
Corpus
))
runSearchRequest
rq
=
runSearchRequest
rq
=
runHalAPIClient
$
search
(
Just
"docid,title_s,abstract_s,submittedDate_s,source_s,authFullName_s,authOrganism_s"
)
rq
Nothing
Nothing
Nothing
runHalAPIClient
$
search
(
Just
requestedFields
)
rq
Nothing
Nothing
Nothing
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